コード例 #1
0
        public async Task <ActionResult> Edit(int id)
        {
            PromoViewModel promo = await PromoService.GetPromo(id);

            if (promo == null)
            {
                string message = string.Format("Promo ID {0} not found", id);
                MvcApplication.LogException(new ArgumentException(message, nameof(id)));
                return(RedirectToAction("NotFound", "Error"));
            }

            PromoEditViewModel model = new PromoEditViewModel()
            {
                Id          = promo.Id,
                Description = promo.Description,
                Active      = promo.Active
            };

            return(View(model));
        }