Exemple #1
0
 public void delete(Rekenings dbitem)
 {
     context.Rekenings.Remove(dbitem);
     var auditrail = new Auditrail { Actionnya = "Delete", EventDate = DateTime.Now, Modulenya = "Product", QueryDetail = "Delete " + dbitem.NamaRekening, RemoteAddress = AppHelper.GetIPAddress(), IdUser = 1 };
     context.Auditrail.Add(auditrail);
     context.SaveChanges();
 }
Exemple #2
0
 public void save(Rekenings dbitem){
     if (dbitem.Id == 0) //create
     {
         context.Rekenings.Add(dbitem);
         var auditrail = new Auditrail { Actionnya = "Add", EventDate = DateTime.Now, Modulenya = "Product", QueryDetail = "Add " + dbitem.NamaRekening, RemoteAddress = AppHelper.GetIPAddress(), IdUser = 1 };
         context.Auditrail.Add(auditrail);
     }
     else //edit
     {
         context.Rekenings.Attach(dbitem);
         var auditrail = new Auditrail { Actionnya = "Edit", EventDate = DateTime.Now, Modulenya = "Product", QueryDetail = "Edit " + dbitem.NamaRekening, RemoteAddress = AppHelper.GetIPAddress(), IdUser = 1 };
         context.Auditrail.Add(auditrail);
         var entry = context.Entry(dbitem);
         entry.State = EntityState.Modified;
     }
     context.SaveChanges();
 }