public static int AddWXUsers(WXUsers model) { using (var entity = new BusEntities()) { var id = 0; try { entity.AddToWXUsers(model); entity.SaveChanges(); id = model.ID; } catch { } return(id); } }
public static bool SaveEditWXUsers(WXUsers model) { using (var entity = new BusEntities()) { var obj = entity.WXUsers.FirstOrDefault(x => x.ID == model.ID); if (obj != null) { obj.OpenID = model.OpenID; obj.NickName = model.NickName; obj.HeadImg = model.HeadImg; obj.Sex = model.Sex; return(entity.SaveChanges() > 0); } return(false); } }