コード例 #1
0
        public async Task <ActionResult> Edit(PromoEditViewModel model)
        {
            if (ModelState.IsValid)
            {
                await PromoService.Update(model);

                return(RedirectToAction("Info", new { id = model.Id }));
            }

            return(View(model));
        }
コード例 #2
0
        public async Task <ActionResult <PromoViewModel> > Update(UpdatePromoBody updatePromoBody)
        {
            try
            {
                Logger.LogInformation("Updating {Id}", updatePromoBody.Id);
                var result = await PromoService.Update(updatePromoBody);

                return(result);
            }
            catch (Exception e)
            {
                Logger.LogInformation("Update exception {Exception}", e.ToString());
                return(BadRequest(e));
            }
        }