public JsonResult Create(ShortMsgConfigDto model) { string errs = GetModelStateError(); if (!string.IsNullOrEmpty(errs)) { return(Json(new OperateMessage <string>(OperateResult.Fail, true, errs))); } bool IsSucceed = _ShortMsgConfigAppService.Create(new ShortMsgConfigDto() { ID = Guid.NewGuid(), AccountName = model.AccountName, AccountPwd = model.AccountPwd, ApiKey = model.ApiKey, ApiSecret = model.ApiSecret, ApiUrl = model.ApiUrl, CallEnumKey = model.CallEnumKey, CreateTime = DateTime.Now, CreatorID = _currUser.ID, IsDefault = model.IsDefault, LastUpdateTime = DateTime.Now, LastUpdateUserID = _currUser.ID, }); if (IsSucceed) { return(Json(new OperateMessage <string>("/ShortMsgConfig/Index"))); } return(Json(new OperateMessage <string>(IsSucceed ? OperateResult.Success : OperateResult.Fail, true, IsSucceed ? "添加成功!" : "添加失败!"))); }
public JsonResult Edit(ShortMsgConfigDto model) { string errs = GetModelStateError(); if (!string.IsNullOrEmpty(errs)) { return(Json(new OperateMessage <string>(OperateResult.Fail, true, errs))); } ShortMsgConfigDto currModel = _ShortMsgConfigAppService.Get(model.ID); if (currModel == null) { return(Json(new OperateMessage <string>(OperateResult.Fail, true, "修改失败,修改的内容不存在!"))); } currModel.AccountName = model.AccountName; currModel.AccountPwd = model.AccountPwd; currModel.ApiKey = model.ApiKey; currModel.ApiSecret = model.ApiSecret; currModel.ApiUrl = model.ApiUrl; currModel.CallEnumKey = model.CallEnumKey; currModel.IsDefault = model.IsDefault; currModel.LastUpdateTime = DateTime.Now; currModel.LastUpdateUserID = _currUser.ID; bool IsSucceed = _ShortMsgConfigAppService.Edit(currModel); if (IsSucceed) { return(Json(new OperateMessage <string>("/ShortMsgConfig/Index"))); } return(Json(new OperateMessage <string>(IsSucceed ? OperateResult.Success : OperateResult.Fail, true, IsSucceed ? "修改成功!" : "修改失败!"))); }
/// <summary> /// edit /// </summary> /// <param name="dto"></param> /// <returns></returns> public bool Edit(ShortMsgConfigDto dto) { try { var entity = _repository.InsertOrUpdate(Mapper.Map <ShortMsgConfig>(dto)); return(entity == null ? false : true); } catch (Exception ex) { _log.LogError("ShortMsgConfigAppService Edit error occured:" + ex.Message); return(false); } }
public IActionResult Edit(Guid ID) { ShortMsgConfigDto currModel = _ShortMsgConfigAppService.Get(ID); return(View(currModel)); }