コード例 #1
0
ファイル: CheckPlanController.cs プロジェクト: 88886/jnmmes
        //
        // GET: /QAM/CheckPlan/Detail
        public async Task <ActionResult> Detail(string key)
        {
            using (CheckPlanServiceClient client = new CheckPlanServiceClient())
            {
                MethodReturnResult <CheckPlan> result = await client.GetAsync(key);

                if (result.Code == 0)
                {
                    CheckPlanViewModel viewModel = new CheckPlanViewModel()
                    {
                        Name        = result.Data.Key,
                        Size        = result.Data.Size,
                        Type        = result.Data.Type,
                        Mode        = result.Data.Mode,
                        Status      = result.Data.Status,
                        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"));
        }
コード例 #2
0
ファイル: CheckPlanController.cs プロジェクト: 88886/jnmmes
        public async Task <ActionResult> SaveModify(CheckPlanViewModel model)
        {
            using (CheckPlanServiceClient client = new CheckPlanServiceClient())
            {
                MethodReturnResult <CheckPlan> result = await client.GetAsync(model.Name);

                if (result.Code == 0)
                {
                    result.Data.Mode        = model.Mode;
                    result.Data.Type        = model.Type;
                    result.Data.Size        = model.Size;
                    result.Data.Status      = model.Status;
                    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(QAMResources.StringResource.CheckPlan_SaveModify_Success
                                                    , model.Name);
                    }
                    return(Json(rst));
                }
                return(Json(result));
            }
        }