My application is in N tier architechture i just want to make it as transaction based
should i add transaction globally
- 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();
- }
-
-
-
- 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();
-
- }
In the above code i want apply transaction based approch .