public ActionResult EditOperationGroup(OperationGroupViewModel operationGroup) { if (IsPost) { SaveOperationGroupDto saveInfo = new SaveOperationGroupDto() { OperationGroup = operationGroup.MapTo <OperationGroupDto>() }; var saveResult = operationGroupAppService.SaveOperationGroup(saveInfo); var ajaxResult = AjaxResult.CopyFromResult(saveResult); ajaxResult.Data = saveResult.Data?.MapTo <OperationGroupViewModel>(); ajaxResult.SuccessClose = true; return(Json(ajaxResult)); } else if (operationGroup.Id > 0) { OperationGroupFilterDto filter = new OperationGroupFilterDto() { Ids = new List <long>() { operationGroup.Id } }; operationGroup = operationGroupAppService.GetOperationGroup(filter).MapTo <OperationGroupViewModel>(); } return(View(operationGroup)); }
public ActionResult Edit(OperationGroupViewModel viewModel) { var request = viewModel.MapTo <SaveOperationGroupRequest>(); var response = _operationGroupService.SaveOperationGroup(request); TempData["IsSuccess"] = response.IsSuccess; TempData["Message"] = response.Message; if (response.IsSuccess) { return(RedirectToAction("Index")); } return(View("Edit", viewModel)); }