Exemple #1
0
        //
        // GET: /ZPVM/RuleDecay/Detail
        public async Task <ActionResult> Detail(string code, double minpower, double maxpower)
        {
            using (RuleDecayServiceClient client = new RuleDecayServiceClient())
            {
                RuleDecayKey key = new RuleDecayKey()
                {
                    Code     = code,
                    MaxPower = maxpower,
                    MinPower = minpower
                };
                MethodReturnResult <RuleDecay> result = await client.GetAsync(key);

                if (result.Code == 0)
                {
                    RuleDecayViewModel viewModel = new RuleDecayViewModel()
                    {
                        Code       = result.Data.Key.Code,
                        MinPower   = result.Data.Key.MinPower,
                        MaxPower   = result.Data.Key.MaxPower,
                        DecayCode  = result.Data.DecayCode,
                        IsUsed     = result.Data.IsUsed,
                        CreateTime = result.Data.CreateTime,
                        Creator    = result.Data.Creator,
                        Editor     = result.Data.Editor,
                        EditTime   = result.Data.EditTime
                    };
                    return(PartialView("_InfoPartial", viewModel));
                }
                else
                {
                    ModelState.AddModelError("", result.Message);
                }
            }
            return(PartialView("_InfoPartial"));
        }
Exemple #2
0
        public async Task <ActionResult> SaveModify(RuleDecayViewModel model)
        {
            using (RuleDecayServiceClient client = new RuleDecayServiceClient())
            {
                RuleDecayKey key = new RuleDecayKey()
                {
                    Code     = model.Code,
                    MaxPower = model.MaxPower.Value,
                    MinPower = model.MinPower.Value
                };
                MethodReturnResult <RuleDecay> result = await client.GetAsync(key);

                if (result.Code == 0)
                {
                    result.Data.DecayCode = model.DecayCode;
                    result.Data.IsUsed    = model.IsUsed;
                    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(ZPVMResources.StringResource.RuleDecay_SaveModify_Success
                                                    , model.Code);
                    }
                    return(Json(rst));
                }
                return(Json(result));
            }
        }