public IActionResult CreateMagazine([FromBody] MagazineDto magazineDto)
        {
            var magazineDtos = _mapper.Map <MagazineDto>(magazineDto);

            var magazine = _magazineService.Create(magazineDtos);

            return(Ok(new {
                Id = magazine.Id,
                Name = magazine.Name,
                Price = magazine.Price,
                Quantity = magazine.Quantity,
                Type = magazine.Type
            }));
        }
Example #2
0
 public IActionResult Create([FromBody] CreateMagazineViewModel magazine)
 {
     try
     {
         _magazineService.Create(magazine);
         return(Ok(magazine));
     }
     catch (BusinessLogicException exception)
     {
         return(BadRequest(exception.Message));
     }
     catch (Exception exception)
     {
         _logger.LogInformation(exception.Message);
         return(StatusCode((int)HttpStatusCode.InternalServerError));
     }
 }
Example #3
0
        public async Task <IActionResult> Create([FromBody] CreateMagazineView createMagazine)
        {
            await _magazineService.Create(createMagazine);

            return(Ok());
        }