Beispiel #1
0
        //
        // GET: /FMM/EquipmentGroup/Detail
        public async Task <ActionResult> Detail(string key)
        {
            using (EquipmentGroupServiceClient client = new EquipmentGroupServiceClient())
            {
                MethodReturnResult <EquipmentGroup> result = await client.GetAsync(key);

                if (result.Code == 0)
                {
                    EquipmentGroupViewModel viewModel = new EquipmentGroupViewModel()
                    {
                        Name        = result.Data.Key,
                        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"));
        }
Beispiel #2
0
        public async Task <ActionResult> SaveModify(EquipmentGroupViewModel model)
        {
            using (EquipmentGroupServiceClient client = new EquipmentGroupServiceClient())
            {
                MethodReturnResult <EquipmentGroup> result = await client.GetAsync(model.Name);

                if (result.Code == 0)
                {
                    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.EquipmentGroup_SaveModify_Success
                                                    , model.Name);
                    }
                    return(Json(rst));
                }
                return(Json(result));
            }
        }