public bool Delete(TableLogViewModel dt, int id) { TableLog dr = db.TableLogs.Where(i => i.tlID == id).FirstOrDefault(); db.TableLogs.Remove(dr); var Result = db.SaveChanges(); return(Result == 1); }
public bool Update(TableLogViewModel dt, int id) { TableLog dr = db.TableLogs.Where(i => i.tlID == id).FirstOrDefault(); dr.tlID = dt.ID; dr.tlType = dt.LogType; dr.tlDate = dt.LogDate; dr.tlDescription = dt.LogDescription; var Result = db.SaveChanges(); return(Result == 1); }
public int Insert(TableLogViewModel dt) { TableLog dr = new TableLog(); dr.tlType = dt.LogType; dr.tlDate = dt.LogDate; dr.tlDescription = dt.LogDescription; db.TableLogs.Add(dr); var Result = db.SaveChanges(); return(dr.tlID); }