public async Task <ActionResult> SaveModify(BaseAttributeViewModel model) { using (BaseAttributeServiceClient client = new BaseAttributeServiceClient()) { MethodReturnResult <BaseAttribute> result = await client.GetAsync(new BaseAttributeKey() { CategoryName = model.CategoryName, AttributeName = model.AttributeName }); if (result.Code == 0) { result.Data.DataType = model.DataType; result.Data.IsPrimaryKey = model.IsPrimaryKey; result.Data.Order = model.Order; 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(StringResource.BaseAttribute_SaveModify_Success , result.Data.Key); } return(Json(rst)); } return(Json(result)); } }
// // GET: /BaseData/BaseAttribute/Detail public async Task <ActionResult> Detail(string categoryName, string attributeName) { using (BaseAttributeServiceClient client = new BaseAttributeServiceClient()) { MethodReturnResult <BaseAttribute> result = await client.GetAsync(new BaseAttributeKey() { CategoryName = categoryName, AttributeName = attributeName }); if (result.Code == 0) { BaseAttributeViewModel viewModel = new BaseAttributeViewModel() { CategoryName = result.Data.Key.CategoryName, AttributeName = result.Data.Key.AttributeName, Order = result.Data.Order, DataType = result.Data.DataType, IsPrimaryKey = result.Data.IsPrimaryKey, 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")); }
public async Task <ActionResult> Save(BaseAttributeViewModel model) { using (BaseAttributeServiceClient client = new BaseAttributeServiceClient()) { BaseAttribute obj = new BaseAttribute() { Key = new BaseAttributeKey() { CategoryName = model.CategoryName, AttributeName = model.AttributeName }, IsPrimaryKey = model.IsPrimaryKey, DataType = model.DataType, Order = model.Order, Description = model.Description, 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(StringResource.BaseAttribute_Save_Success , obj.Key); } return(Json(rst)); } }