public IActionResult Post(Carrito_ProductoDto carrito_producto) { try { return(new JsonResult(_service.createCarrito_producto(carrito_producto)) { StatusCode = 201 }); } catch (Exception e) { return(BadRequest(e.Message)); } }
public GenericCreateResponseDto createCarrito_producto(Carrito_ProductoDto carrito_productoDto) { //List<Producto> productos = new List<Producto>(); var entity = new Carrito_Producto { productoId = carrito_productoDto.productoId, carritoId = carrito_productoDto.carritoId, carritoNavigator = carrito_productoDto.carritoNavigator }; _repository.Add(entity); return(new GenericCreateResponseDto { Entity = "Carrito_Producto", Id = entity.carrito_productoId.ToString() }); }