Пример #1
0
 public async Task <ActionResult <SiteDto> > AddOrUpdateSite(SiteDto siteDto)
 {
     try
     {
         var userEmail = GetUserEmail();
         if (siteDto.Id != default && !await _securityService.HasUserAccessToSite(siteDto.Id, userEmail))
         {
             return(Forbid());
         }
         return(Ok(await _siteService.AddOrUpdateSiteAsync(siteDto, userEmail)));
     }
     catch (Exception ex)
     {
         return(BadRequest(new { message = $"Error occurred attempting to add or update site: {ex.InnerException?.Message ?? ex.Message}" }));
     }
 }