public async Task <IActionResult> GetLevels() { var result = new JsonResult(false); try { _logger.LogInformation("BEGIN GetLevels"); var availableLevels = await LactafarmaService.GetLevelsAsync(); result = Json(availableLevels); _logger.LogInformation("END GetLevels"); } catch (Exception ex) { _logger.LogError( $"Exception on JsonResult called GetLevels with message {ex.Message}"); } finally { if (result == null) { _logger.LogWarning("No results for current request!!!"); } } return(result); }
public IEnumerable <Domain.Models.Group> GetGroupsByProduct(int productId) { IEnumerable <Domain.Models.Group> result = null; try { _logger.LogInformation("BEGIN GetGroupsByProduct"); result = LactafarmaService.GetGroupsByProduct(productId); _logger.LogInformation("END GetGroupsByProduct"); } catch (Exception ex) { _logger.LogError( $"Exception on JsonResult called GetGroupsByProduct(productId={productId}) with message {ex.Message}"); } finally { if (result == null) { _logger.LogWarning("No results for current request!!!"); } } return(result); }
public async Task <IActionResult> GetLogs() { IActionResult result = null; try { _logger.LogInformation("BEGIN GetLogs"); var logs = await LactafarmaService.GetLogsAsync(new LogPagedDataRequest { FromDate = DateTime.Now.Subtract(TimeSpan.FromDays(7)), ToDate = DateTime.Now, PageSize = 500 }); result = Json(logs); await _mailService.SendEmailAsync("*****@*****.**", "Logs information was requested - ALL", $"User {User.Identity.Name} has requested log data"); _logger.LogInformation("END GetLogs"); } catch (Exception ex) { _logger.LogError( $"Exception on JsonResult called GetLogs with message {ex.Message}"); } finally { if (result == null) { _logger.LogWarning("No results for current request!!!"); } } return(result); }
public IEnumerable <Domain.Models.Favorite> GetFavoritesByUser() { IEnumerable <Domain.Models.Favorite> result = null; var userId = _userManager.GetUserId(User); try { _logger.LogInformation("BEGIN GetFavoritesByUser"); result = LactafarmaService.GetFavoritesByUser(Guid.Parse(userId)); _logger.LogInformation("END GetFavoritesByUser"); } catch (Exception ex) { _logger.LogError( $"Exception on JsonResult called GetFavoritesByUser(userId={userId}) with message {ex.Message}"); } finally { if (result == null) { _logger.LogWarning("No results for current request!!!"); } } return(result); }
private async Task LoadCachesAsync() { try { _logger.LogInformation("BEGIN LoadCachesAsync"); await Task.Run(() => CacheInitialize(LactafarmaService.GetAllProducts(), EntityType.Product)); await Task.Run(() => CacheInitialize(LactafarmaService.GetAllAliases(), EntityType.Alias)); await Task.Run(() => CacheInitialize(LactafarmaService.GetAllBrands(), EntityType.Brand)); await Task.Run(() => CacheInitialize(LactafarmaService.GetAllGroups(), EntityType.Group)); _logger.LogInformation("END LoadCachesAsync"); } catch (Exception ex) { _logger.LogError( $"Exception on JsonResult called LoadCachesAsync with message {ex.Message}"); } }
public Domain.Models.Favorite GetFavorite(int favoriteId) { Domain.Models.Favorite result = null; try { _logger.LogInformation("BEGIN GetFavorite"); result = LactafarmaService.GetFavorite(favoriteId); _logger.LogInformation("END GetFavorite"); } catch (Exception ex) { _logger.LogError($"Exception on JsonResult called GetFavorite(favoriteId={favoriteId}) with message {ex.Message}"); } finally { if (result == null) { _logger.LogWarning("No results for current request!!!"); } } return(result); }
public Domain.Models.Product GetProductByAlias(int aliasId) { Domain.Models.Product result = null; try { _logger.LogInformation("BEGIN GetProductByAlias"); result = LactafarmaService.GetProductByAlias(aliasId); _logger.LogInformation("END GetProductByAlias"); } catch (Exception ex) { _logger.LogError( $"Exception on JsonResult called GetProductByAlias(aliasId={aliasId}) with message {ex.Message}"); } finally { if (result == null) { _logger.LogWarning("No results for current request!!!"); } } return(result); }
public IEnumerable <Domain.Models.Alert> GetLastAlerts() { IEnumerable <Domain.Models.Alert> result = null; try { _logger.LogInformation("BEGIN GetLastAlerts"); result = LactafarmaService.GetLastAlerts(); _logger.LogInformation("END GetLastAlerts"); } catch (Exception ex) { _logger.LogError( $"Exception on JsonResult called GetLastAlerts with message {ex.Message}"); } finally { if (result == null) { _logger.LogWarning("No results for current request!!!"); } } return(result); }