public bool Update(int lineId, int assignId, string date) { try { var obj = Get(lineId, date); if (obj != null) { obj.AssignmentId = assignId; db.SaveChanges(); return(true); } else { obj = new P_HistoryPressedKeypad(); obj.Id = 0; obj.LineId = lineId; obj.AssignmentId = assignId; obj.Date = date; obj.IsDeleted = false; Insert(obj); } } catch (Exception) { } return(false); }
public bool Insert(P_HistoryPressedKeypad objModel) { try { db.P_HistoryPressedKeypad.Add(objModel); db.SaveChanges(); return(true); } catch (Exception) { } return(false); }