public static bool ChangeLineUser(LineUser model) { using (var entity = new BusEntities()) { var obj = entity.LineUser.FirstOrDefault(x => x.ID == model.ID); if (obj != null) { obj.UserID = model.UserID; return(entity.SaveChanges() > 0); } return(false); } }
public static int AddLineUser(LineUser model) { using (var entity = new BusEntities()) { var id = 0; try { entity.AddToLineUser(model); entity.SaveChanges(); id = model.ID; } catch { } return(id); } }
public static bool SaveEditLineUser(LineUser model) { using (var entity = new BusEntities()) { var obj = entity.LineUser.FirstOrDefault(x => x.ID == model.ID); if (obj != null) { obj.LineID = model.LineID; obj.UserID = model.UserID; obj.Names = model.Names; obj.Phone = model.Phone; obj.StartAddress = model.StartAddress; obj.EndAddress = model.EndAddress; obj.EndTime = model.EndTime; obj.Memo = model.Memo; obj.EMail = model.EMail; obj.QQ = model.QQ; obj.StateID = model.StateID; return(entity.SaveChanges() > 0); } return(false); } }