public MessageDetailEntity Update (MessageDetailEntity entity) { try { _messagedetailRepository.Update(entity); return entity; } catch (Exception e) { _log.Error(e,"数据库操作出错"); return null; } }
public bool Delete(MessageDetailEntity entity) { try { _messagedetailRepository.Delete(entity); return true; } catch (Exception e) { _log.Error(e,"数据库操作出错"); return false; } }
public HttpResponseMessage AddMessageDetail(MessageDetailModel messageDetailModel) { if (!string.IsNullOrEmpty(messageDetailModel.Title) && !string.IsNullOrEmpty(messageDetailModel.Content) && !string.IsNullOrEmpty(messageDetailModel.Sender) && !string.IsNullOrEmpty(messageDetailModel.Mobile)) { if (!PageHelper.IsMobilePhone(messageDetailModel.Mobile)) { return PageHelper.toJson(PageHelper.ReturnValue(false, "手机号格式验证错误!")); } var MessageDetailInsert = new MessageDetailEntity() { Title = messageDetailModel.Title, Content = messageDetailModel.Content, Sender = messageDetailModel.Sender, Mobile = messageDetailModel.Mobile, Addtime = DateTime.Now }; try { if (_messageDetailService.Create(MessageDetailInsert) != null) { return PageHelper.toJson(PageHelper.ReturnValue(true, "数据添加成功!")); } } catch { return PageHelper.toJson(PageHelper.ReturnValue(false, "数据添加失败!")); } } return PageHelper.toJson(PageHelper.ReturnValue(false, "数据验证错误!")); }
/// <summary> /// 添加到短信表中 /// </summary> /// <param name="messageDetail">短信参数</param> public void AddMessageDetails(MessageDetailEntity messageDetail) { _messageService.Create(messageDetail); }