ejaz mirza

ejaz mirza

  • NA
  • 471
  • 47.5k

Transaction based approch in asp.net mvc5

Aug 5 2019 6:05 AM
My application is in N tier architechture i just want to make it as transaction based
 
should i add transaction globally
  1.  public ActionResult adddepartment(LbMsDepartment dt)  
  2.         {  
  3.               
  4.             dt.CreatedBy = 1;  
  5.             dt.CreatedOn = DateTime.Now;  
  6.             dt.OS = ""+1;  
  7.             dt.Browser = ""+1;  
  8.             dt.DeptStat = true;  
  9.             dt.IP = ""+1;  
  10.               
  11.             testingtranscationAdd(dt);  
  12.              testingtranscationupdate(dt);  
  13.             return View();  
  14.         }  
  15.   
  16. //in BLL Layer  the two mthods splits like that in DLL also   
  17.   
  18.         public void testingtranscationAdd(LbMsDepartment dt)  
  19.         {  
  20.             dt.DeptName = "tested";  
  21.             dt.DeptDesc = "transaction testing";  
  22.             hms.LbMsDepartments.Add(dt);  
  23.             int i = hms.SaveChanges();  
  24.               
  25.         }  
  26.   
  27.    public void testingtranscationupdate(LbMsDepartment dt)  
  28.         {  
  29.             dt.DeptName = "tested";  
  30.             dt.DeptDesc = "transaction testing";  
  31.             hms.LbMsDepartments.Add(dt);  
  32.             int i = hms.SaveChanges();  
  33.               
  34.         }  
In the above code i want apply transaction based approch .
 

Answers (3)