Esempio n. 1
0
        public IActionResult Update(ApiSettings apiSettings)
        {
            VMAward vMAward = ConvertJson.Deserialize <VMAward>(apiSettings.Obj.ToString());
            bool    result  = _awardService.Update(vMAward).Result;

            return(Ok(result));
        }
Esempio n. 2
0
        public async Task <bool> Update(VMAward award)
        {
            List <Award> awards = await _awardService.GetAll().AsNoTracking().ToListAsync <Award>(); // AsNoTracking is important to update.

            var     vmAwards = _mapper.Map <List <VMAward> >(awards);
            VMAward vMAward  = vmAwards.Where(x => x.Id == award.Id).FirstOrDefault();

            vMAward.Name = award.Name;
            await _awardService.UpdateAsync(vMAward);

            return(true);
        }
Esempio n. 3
0
        public async Task <IActionResult> Update()
        {
            VMAward vMAward = new VMAward()
            {
                Id   = 1,
                Name = "Champion"
            };

            apiSettings.Action = "update";
            apiSettings.Obj    = ConvertJson.Serialize(vMAward);
            bool result = await _apiHelper.PutRequest(apiPath, apiSettings);

            return(View());
        }