public bool Delete(int id) { var temp = false; using (var context = new db_cmaEntities()) { DOBase <tb_message> tRole = new DOBase <tb_message>(context); tRole.Delete(id); temp = tRole.SaveChang() > 0 ? true : false; } return(temp); }
public bool Add(MessageModel model) { var temp = false; using (var context = new db_cmaEntities()) { DOBase <tb_message> tRole = new DOBase <tb_message>(context); tRole.Add(GetModel(model)); context.Configuration.ValidateOnSaveEnabled = false; temp = tRole.SaveChang() > 0 ? true : false; context.Configuration.ValidateOnSaveEnabled = true; } return(temp); }
public bool Edit(MessageModel model) { var temp = false; using (var context = new db_cmaEntities()) { DOBase <tb_message> tRole = new DOBase <tb_message>(context); tRole.Edit(GetModel(model), new string[] { "Value", "Time" }); temp = tRole.SaveChang() > 0 ? true : false; //context.Configuration.ValidateOnSaveEnabled = true; } return(temp); }