Ejemplo n.º 1
0
        public ActionResult <DeliveryCompanyDTO> CreateDeliveryCompany([FromBody] DeliveryCompanyDTO model)
        {
            try
            {
                IMapper mapper = EDeliveryProfile.CreateDeliveryCompany();

                var deliveryCompany = mapper.Map <DeliveryCompany>(model);

                _repository.CreateDeliveryCompany(deliveryCompany);

                return(new ObjectResult(new { message = "success", statusCode = HttpStatusCode.OK, response = "Created delivery company" }));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Failed to create new Delivery Company:{ex}");
                return(BadRequest("Failed to create new Delivery Company"));
            }
        }