Ejemplo n.º 1
0
        //
        // GET: /FMM/ReasonCode/Detail
        public async Task <ActionResult> Detail(string key)
        {
            using (ReasonCodeServiceClient client = new ReasonCodeServiceClient())
            {
                MethodReturnResult <ReasonCode> result = await client.GetAsync(key);

                if (result.Code == 0)
                {
                    ReasonCodeViewModel viewModel = new ReasonCodeViewModel()
                    {
                        Name        = result.Data.Key,
                        Type        = result.Data.Type,
                        Class       = result.Data.Class,
                        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"));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> SaveModify(ReasonCodeViewModel model)
        {
            using (ReasonCodeServiceClient client = new ReasonCodeServiceClient())
            {
                MethodReturnResult <ReasonCode> result = await client.GetAsync(model.Name);

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