// // GET: /FMM/ReasonCodeCategory/Detail public async Task <ActionResult> Detail(string key) { using (ReasonCodeCategoryServiceClient client = new ReasonCodeCategoryServiceClient()) { MethodReturnResult <ReasonCodeCategory> result = await client.GetAsync(key); if (result.Code == 0) { ReasonCodeCategoryViewModel viewModel = new ReasonCodeCategoryViewModel() { Name = result.Data.Key, Type = result.Data.Type, CreateTime = result.Data.CreateTime, Creator = result.Data.Creator, Description = result.Data.Description, Editor = result.Data.Editor, EditTime = result.Data.EditTime }; return(PartialView("_InfoPartial", viewModel)); } else { ModelState.AddModelError("", result.Message); } } return(PartialView("_InfoPartial")); }
// // GET: /FMM/ReasonCodeCategoryDetail/ public async Task <ActionResult> Index(string categoryName) { using (ReasonCodeCategoryServiceClient client = new ReasonCodeCategoryServiceClient()) { MethodReturnResult <ReasonCodeCategory> result = await client.GetAsync(categoryName ?? string.Empty); if (result.Code > 0 || result.Data == null) { return(RedirectToAction("Index", "ReasonCodeCategory")); } ViewBag.ReasonCodeCategory = result.Data; } using (ReasonCodeCategoryDetailServiceClient client = new ReasonCodeCategoryDetailServiceClient()) { await Task.Run(() => { PagingConfig cfg = new PagingConfig() { OrderBy = "ItemNo", Where = string.Format(" Key.ReasonCodeCategoryName = '{0}'" , categoryName) }; MethodReturnResult <IList <ReasonCodeCategoryDetail> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } return(View(new ReasonCodeCategoryDetailQueryViewModel() { ReasonCodeCategoryName = categoryName })); }
public async Task <ActionResult> SaveModify(ReasonCodeCategoryViewModel model) { using (ReasonCodeCategoryServiceClient client = new ReasonCodeCategoryServiceClient()) { MethodReturnResult <ReasonCodeCategory> result = await client.GetAsync(model.Name); if (result.Code == 0) { result.Data.Type = model.Type; result.Data.Description = model.Description; result.Data.Editor = User.Identity.Name; result.Data.EditTime = DateTime.Now; MethodReturnResult rst = await client.ModifyAsync(result.Data); if (rst.Code == 0) { rst.Message = string.Format(FMMResources.StringResource.ReasonCodeCategory_SaveModify_Success , model.Name); } return(Json(rst)); } return(Json(result)); } }