My application is in N tier architechture i just want to make it as transaction based
should i add transaction globallyIn the above code i want apply transaction based approch .
- public ActionResult adddepartment(LbMsDepartment dt)
- {
- dt.CreatedBy = 1;
- dt.CreatedOn = DateTime.Now;
- dt.OS = ""+1;
- dt.Browser = ""+1;
- dt.DeptStat = true;
- dt.IP = ""+1;
- testingtranscationAdd(dt);
- testingtranscationupdate(dt);
- return View();
- }
- //in BLL Layer the two mthods splits like that in DLL also
- public void testingtranscationAdd(LbMsDepartment dt)
- {
- dt.DeptName = "tested";
- dt.DeptDesc = "transaction testing";
- hms.LbMsDepartments.Add(dt);
- int i = hms.SaveChanges();
- }
- public void testingtranscationupdate(LbMsDepartment dt)
- {
- dt.DeptName = "tested";
- dt.DeptDesc = "transaction testing";
- hms.LbMsDepartments.Add(dt);
- int i = hms.SaveChanges();
- }

Chittaranjan SwainRank #216 · 11.3K reputationPosted Aug 5, 2019, 7:16 PM EDT
Amit MohantyRank #112 · 20K reputationPosted Aug 5, 2019, 7:29 PM EDT
ejaz mirzaRank #2,930 · 491 reputationPosted Aug 5, 2019, 8:20 PM EDT