Esempio n. 1
0
        public async Task <IActionResult> Upsert(RequestViewModel requestViewModel, Guid?id)
        {
            if (!ModelState.IsValid)
            {
                return(View(requestViewModel));
            }

            if (!id.HasValue || id.Value == Guid.Empty)
            {
                await _ongAppService.CreateRequest(requestViewModel);

                TempData[TempDataConstants.ShowAlert] = AlertFactory.NewRequestCreated();
            }
            else
            {
                await _ongAppService.UpdateRequest(requestViewModel);

                TempData[TempDataConstants.ShowAlert] = AlertFactory.RequestEdited();
            }

            return(RedirectToAction("Index", new { area = "ONG" }));
        }