Example #1
0
        public async Task <ActionResult> SaveModify(ClientConfigAttributeViewModel model)
        {
            using (ClientConfigAttributeServiceClient client = new ClientConfigAttributeServiceClient())
            {
                MethodReturnResult <ClientConfigAttribute> result = await client.GetAsync(new ClientConfigAttributeKey()
                {
                    ClientName    = model.ClientName,
                    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.ClientConfigAttribute_SaveModify_Success
                                                    , result.Data.Key);
                    }
                    return(Json(rst));
                }
                return(Json(result));
            }
        }
Example #2
0
        //
        // GET: /FMM/ClientConfigAttribute/Detail
        public async Task <ActionResult> Detail(string clientName, string attributeName)
        {
            using (ClientConfigAttributeServiceClient client = new ClientConfigAttributeServiceClient())
            {
                MethodReturnResult <ClientConfigAttribute> result = await client.GetAsync(new ClientConfigAttributeKey()
                {
                    ClientName    = clientName,
                    AttributeName = attributeName
                });

                if (result.Code == 0)
                {
                    ClientConfigAttributeViewModel viewModel = new ClientConfigAttributeViewModel()
                    {
                        ClientName    = result.Data.Key.ClientName,
                        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"));
        }
Example #3
0
        public async Task <ActionResult> Save(ClientConfigAttributeViewModel model)
        {
            using (ClientConfigAttributeServiceClient client = new ClientConfigAttributeServiceClient())
            {
                ClientConfigAttribute obj = new ClientConfigAttribute()
                {
                    Key = new ClientConfigAttributeKey()
                    {
                        ClientName    = model.ClientName,
                        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.ClientConfigAttribute_Save_Success
                                                , obj.Key);
                }
                return(Json(rst));
            }
        }