public async Task <IActionResult> AddRoasterRequest([FromBody] RoasterRequest roasterRequest)
        {
            try
            {
                var roasterrequest = RoasterRequest.New(roasterRequest.Roaster, roasterRequest.Address, roasterRequest.TagString);
                roasterrequest.Picture = PictureRequest.New(roasterrequest.Picture.Bytes);
                _roasterRequestRepository.Add(roasterRequest);
                await _roasterRequestRepository.SaveChangesAsync();

                return(Ok());
            }
            catch (Exception e)
            {
                return(BadRequest($"{e.Message}"));
            }
        }
Example #2
0
        public async Task SendRoasterRequest(RoasterRequestDT roasterRequestDT)
        {
            try
            {
                _logger.Information("Roaster service layer access in progress...");

                var roasterRequest = RoasterRequestServiceBuilder.GenerateRoasterRequest(roasterRequestDT,
                                                                                         _pictureRequestRepository);
                _roasterRequestRepository.Add(roasterRequest);
                await _roasterRequestRepository.SaveChangesAsync();

                _logger.Information($"Roaster request table has been modified. Inserted request:\n Id:{roasterRequest.Id}");
            }
            catch (Exception e)
            {
                _logger.Error(e, "Roaster service layer error occured!");
            }
        }