Exemplo n.º 1
0
        public async Task <IActionResult> AddWithData(AddGiftWithDataRequest addGiftWithDataRequest)
        {
            if (!await eventService.ValidateAccessAsync(addGiftWithDataRequest.EventId, User))
            {
                return(RedirectToAction(nameof(HomeController.Index), "Home"));
            }

            if (ModelState.IsValid)
            {
                await giftService.SaveGiftAsync(addGiftWithDataRequest);

                return(RedirectToAction(nameof(EventController.Show), "Event", new { id = addGiftWithDataRequest.EventId }));
            }
            return(View(addGiftWithDataRequest));
        }