public Response <ConsumptionInfo> GetConsumptionInfo(int beerId, [FromBody] User userName) { Response <ConsumptionInfo> response; try { BeerLogic beerLogic = new BeerLogic(); response = beerLogic.GetConsumption(userName.UserName, beerId); } catch (Exception) { //Log the Exception into SQL or Elastic Search or disk(Log4Net or Serilog) response = new Response <ConsumptionInfo> { Message = "Error during the execution", Success = false, StatusCode = 29 }; } return(response); }
public Response <Beer> GetById(int id) { Response <Beer> response; try { BeerLogic logic = new BeerLogic(); response = logic.GetBeerById(id); } catch (Exception) { //Log the Exception into SQL or Elastic Search or disk(Log4Net or Serilog) response = new Response <Beer> { Message = "Error during the execution", Success = false, StatusCode = 29 }; } return(response); }
public BeerController() { _logic = new BeerLogic(new EFGenericRepository <BeerPoco>()); }