public async Task <ActionResult> SaveModify(RouteEnterpriseDetailViewModel model) { using (RouteEnterpriseDetailServiceClient client = new RouteEnterpriseDetailServiceClient()) { MethodReturnResult <RouteEnterpriseDetail> result = await client.GetAsync(new RouteEnterpriseDetailKey() { RouteEnterpriseName = model.RouteEnterpriseName, RouteName = model.RouteName }); if (result.Code == 0) { result.Data.ItemNo = model.ItemNo; 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.RouteEnterpriseDetail_SaveModify_Success , result.Data.Key); } return(Json(rst)); } return(Json(result)); } }
// // GET: /FMM/RouteEnterpriseDetail/Detail public async Task <ActionResult> Detail(string routeEnterpriseName, string routeName) { using (RouteEnterpriseDetailServiceClient client = new RouteEnterpriseDetailServiceClient()) { MethodReturnResult <RouteEnterpriseDetail> result = await client.GetAsync(new RouteEnterpriseDetailKey() { RouteEnterpriseName = routeEnterpriseName, RouteName = routeName }); if (result.Code == 0) { RouteEnterpriseDetailViewModel viewModel = new RouteEnterpriseDetailViewModel() { RouteEnterpriseName = result.Data.Key.RouteEnterpriseName, RouteName = result.Data.Key.RouteName, ItemNo = result.Data.ItemNo, Editor = result.Data.Editor, EditTime = result.Data.EditTime, CreateTime = result.Data.CreateTime, Creator = result.Data.Creator }; return(PartialView("_InfoPartial", viewModel)); } else { ModelState.AddModelError("", result.Message); } } return(PartialView("_InfoPartial")); }
public async Task <ActionResult> Save(RouteEnterpriseDetailViewModel model) { using (RouteEnterpriseDetailServiceClient client = new RouteEnterpriseDetailServiceClient()) { RouteEnterpriseDetail obj = new RouteEnterpriseDetail() { Key = new RouteEnterpriseDetailKey() { RouteEnterpriseName = model.RouteEnterpriseName, RouteName = model.RouteName }, ItemNo = model.ItemNo, Editor = User.Identity.Name, EditTime = DateTime.Now, CreateTime = DateTime.Now, Creator = User.Identity.Name }; MethodReturnResult rst = await client.AddAsync(obj); if (rst.Code == 0) { rst.Message = string.Format(FMMResources.StringResource.RouteEnterpriseDetail_Save_Success , obj.Key); } return(Json(rst)); } }