public bool Edit(UserMySql model) { using (var context = new MySqlDbContext()) { context.UserMySql.Update(model); return(context.SaveChanges() > 0); } }
public bool Add(UserMySql model) { UserMySql user = new UserMySql(); user = context.Insert(model); if (user == null || string.IsNullOrEmpty(user.ID)) { return(false); } return(true); }
public bool Delete(string Id) { var model = new UserMySql { ID = Id }; using (var context = new MySqlDbContext()) { context.UserMySql.Remove(model); return(context.SaveChanges() > 0); } }
public void UpdateByChloe() { var model = new UserMySql { ID = "3D9ED995-3AD9-4AA5-8B0D-2741146148F9", Name = "缘分", Phone = "15130079715", Address = "北京昌平区天通西苑三区", Email = "*****@*****.**", }; var result = Hubert.Service.System.UserService.Instance.UpdateByChloe(model); }
public void AddByChloe() { var model = new UserMySql { ID = Guid.NewGuid().ToString("N"), Name = "豆子11", Address = "河北邯郸", Email = "*****@*****.**", Phone = "15130079715" }; var result = Hubert.Service.System.UserService.Instance.AddByChloe(model); }
public void UpdateUserByEF() { var model = new UserMySql { ID = "4ce34ce90c42468b9a4a574ff0620e0e", Name = "HubertBiyo", Phone = "15130079715", Address = "北京昌平区天通西苑三区", Email = "*****@*****.**", }; var result = Hubert.Service.System.UserService.Instance.UpdateByEF(model); }
public bool Add(UserMySql model) { using (var context = new MySqlDbContext()) { context.UserMySql.Add(new UserMySql { ID = model.ID, Name = model.Name, Address = model.Address, Email = model.Email, Phone = model.Phone }); return(context.SaveChanges() > 0); } }
public Result AddByChloe(UserMySql model) { try { if (model == null) { return(new Result(-1, "参数错误")); } var isOk = Hubert.ORM.Chloe.DataProviders.UserDataProvider.Add(model); return(isOk ? new Result(0, "创建成功") : new Result(-1, "创建失败")); } catch (Exception ex) { Logger.Error("AddMySql is Error", GetType(), ex); return(new Result(-1, "服务器异常")); } }
public Result UpdateByEF(UserMySql model) { try { if (model == null || string.IsNullOrEmpty(model.ID)) { return(new Result(-1, "参数错误")); } var isOk = Hubert.ORM.EF.DataProviders.UserDataProvider.Edit(model); return(isOk ? new Result(0, "更新成功") : new Result(-1, "更新失败")); } catch (Exception ex) { Logger.Error("UpdateUser is error", GetType(), ex); return(new Result(-1, "系统异常")); } }
public Result UpdateByChloe(UserMySql model) { try { if (model is null) { return(new Result(-1, "参数错误")); } var isOk = Hubert.ORM.Chloe.DataProviders.UserDataProvider.Edit(model); return(isOk ? new Result(0, "更新成功") : new Result(-1, "更新失败")); } catch (Exception e) { Logger.Error("UpdateMySql is Error", GetType(), e); return(new Result(-1, "服务器异常")); } }
public bool Edit(UserMySql model) { UserMySql user = new UserMySql(); return(context.Update(model) > 0); }