Exemple #1
0
        public async Task <ActionResult> SaveModify(RouteOperationAttributeViewModel model)
        {
            using (RouteOperationAttributeServiceClient client = new RouteOperationAttributeServiceClient())
            {
                MethodReturnResult <RouteOperationAttribute> result = await client.GetAsync(new RouteOperationAttributeKey()
                {
                    RouteOperationName = model.RouteOperationName,
                    AttributeName      = model.AttributeName
                });

                if (result.Code == 0)
                {
                    result.Data.Value    = model.Value;
                    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.RouteOperationAttribute_SaveModify_Success
                                                    , result.Data.Key);
                    }
                    return(Json(rst));
                }
                return(Json(result));
            }
        }
Exemple #2
0
        //
        // GET: /FMM/RouteOperationAttribute/Detail
        public async Task <ActionResult> Detail(string routeOperationName, string attributeName)
        {
            using (RouteOperationAttributeServiceClient client = new RouteOperationAttributeServiceClient())
            {
                MethodReturnResult <RouteOperationAttribute> result = await client.GetAsync(new RouteOperationAttributeKey()
                {
                    RouteOperationName = routeOperationName,
                    AttributeName      = attributeName
                });

                if (result.Code == 0)
                {
                    RouteOperationAttributeViewModel viewModel = new RouteOperationAttributeViewModel()
                    {
                        RouteOperationName = result.Data.Key.RouteOperationName,
                        AttributeName      = result.Data.Key.AttributeName,
                        Value    = result.Data.Value,
                        Editor   = result.Data.Editor,
                        EditTime = result.Data.EditTime
                    };
                    return(PartialView("_InfoPartial", viewModel));
                }
                else
                {
                    ModelState.AddModelError("", result.Message);
                }
            }
            return(PartialView("_InfoPartial"));
        }
Exemple #3
0
        public async Task <ActionResult> Save(RouteOperationAttributeViewModel model)
        {
            using (RouteOperationAttributeServiceClient client = new RouteOperationAttributeServiceClient())
            {
                RouteOperationAttribute obj = new RouteOperationAttribute()
                {
                    Key = new RouteOperationAttributeKey()
                    {
                        RouteOperationName = model.RouteOperationName,
                        AttributeName      = model.AttributeName
                    },
                    Value    = model.Value,
                    Editor   = User.Identity.Name,
                    EditTime = DateTime.Now,
                };
                MethodReturnResult rst = await client.AddAsync(obj);

                if (rst.Code == 0)
                {
                    rst.Message = string.Format(FMMResources.StringResource.RouteOperationAttribute_Save_Success
                                                , obj.Key);
                }
                return(Json(rst));
            }
        }