public IActionResult Create(Price price) { try { _priceService.Create(price); return(Ok()); } catch (AppException ex) { return(BadRequest(new { message = ex.Message })); } }
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)); }
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 })); } }
public ApiResultModel <PRECIO> Create([FromBody] PRECIO aux) => GetApiResultModel(() => _priceService.Create(aux));