Exemplo n.º 1
0
 public IActionResult Create(Price price)
 {
     try {
         _priceService.Create(price);
         return(Ok());
     } catch (AppException ex) {
         return(BadRequest(new { message = ex.Message }));
     }
 }
Exemplo n.º 2
0
        public IActionResult Create([FromBody] PriceDTO priceDTO)
        {
            Price price = new Price();

            price.Price1   = priceDTO.Price1;
            price.Count    = priceDTO.Count;
            price.IsActive = priceDTO.IsActive;

            var priceEntity = _priceService.Create(price);
            var prices      = _mapper.Map <PriceDTO>(priceEntity);

            return(Ok(price));
        }
Exemplo n.º 3
0
        public IActionResult Create([FromBody] PriceModel model)
        {
            // map model to entity
            var price = _mapper.Map <Price>(model);

            try
            {
                // create user
                var response = _priceService.Create(price);
                return(Ok(response));
            }
            catch (AppException ex)
            {
                // return error message if there was an exception
                return(BadRequest(new { message = ex.Message }));
            }
        }
Exemplo n.º 4
0
 public ApiResultModel <PRECIO> Create([FromBody] PRECIO aux) => GetApiResultModel(() => _priceService.Create(aux));