public async Task <SizeModel> GetSizeById(int id) { var entity = await _repository.GetById(id); var model = entity?.MapTo <SizeModel>(); return(model); }
public SizeDto DeleteSize(int id) { var existed = this.SizeExists(id); if (!existed) { return(null); } var size = _repo.GetById(id); int res = _repo.Delete(size); if (res <= 0) { return(null); } return(_mapper.Map <SizeDto>(size)); }
public ProductDetailDto GetProductDetail(int id) { var detail = _repo.GetById(id); detail.Color = _colorRepo.GetById(detail.ColorId); detail.Size = _sizeRepo.GetById(detail.SizeId); detail.Product = _productRepo.GetById(detail.ProductId); return(_mapper.Map <ProductDetailDto>(detail)); }
public List <OrderDetail> GetOrderDetails(int orderId) { List <OrderDetail> orderDetails = _orderDetailRepository .GetAll() .Where(od => od.OrderId == orderId) .ToList(); foreach (var od in orderDetails) { od.Shoes = _shoesRepository.GetById(od.ShoesId.Value); od.Shoes.OrderDetail = null; od.Size = _sizeRepository.GetById(od.SizeId.Value); od.Size.OrderDetail = null; } return(orderDetails); }