public async Task <IActionResult> AddAdvertisement(AddAdvertisementRequest request) { if (request is null) { throw new ArgumentNullException(nameof(request)); } if (!ModelState.IsValid) { return(View()); } var userId = User.Claims.GetUserId(); try { await _adService.AddAdvertisement(request, userId); } catch (Exception ex) { ViewBag.Message = ex.Message; return(View()); } return(RedirectToAction("Index")); }