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

                if (result.Code == 0)
                {
                    LineStoreViewModel viewModel = new LineStoreViewModel()
                    {
                        Name = result.Data.Key,
                        RouteOperationName = result.Data.RouteOperationName,
                        LocationName       = result.Data.LocationName,
                        Type        = result.Data.Type,
                        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
ファイル: LineStoreController.cs プロジェクト: 88886/jnmmes
        public async Task <ActionResult> SaveModify(LineStoreViewModel model)
        {
            using (LineStoreServiceClient client = new LineStoreServiceClient())
            {
                MethodReturnResult <LineStore> result = await client.GetAsync(model.Name);

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