public ActionResult <Response> GetSubCategorias() { Response response = new ListarSubCategoriasService(this._unitOfWork). GetSubCategorias(); return(Ok(response)); }
public Response BuscarProducto(int id) { Producto producto = this._unitOfWork.ProductoRepository. FindBy(producto => producto.Id == id, includeProperties: "SubCategoria") .FirstOrDefault(); if (producto == null) { return(new Response { Mensaje = $"El producto con Id {id}, no fue encontrado" }); } ProductoSubCategoria subCategoria = new ListarSubCategoriasService(this._unitOfWork) .BuscarSubCategoriaConId(producto.SubCategoriaId); subCategoria.Productos = null; producto.SubCategoria = subCategoria; return(new Response { Data = new ProductoRequest().Map(producto) }); }