Ejemplo n.º 1
0
 public IActionResult Get(string storeName)
 {
     try
     {
         var store = _storeService.GetStore(storeName);
         if (store == null)
         {
             throw new AppException("Витрина недоступна!");
         }
         var hash = AppFileSystem.GetUserMD5(store.UserInfo.Id, store.UserInfo.Login);
         _storeService.AddVisit(store.Id);
         _logger.LogInformation($"Visit store #{store.Id}");
         return(Ok(new
         {
             Store = _mapper.Map <StoreForClientDto>(store),
             Hash = hash
         }));
     }
     catch (AppException ex)
     {
         return(BadRequest(ex.Message));
     }
     catch (Exception ex)
     {
         _logger.LogCritical($"{ex}");
         return(BadRequest("Service error!"));
     }
 }