public ViewResult New(int?id) { var product = new ProductAddEditVM(); if (id != null) { product = _ProductRepository.Get((int)id).toProductAddEditVM(); } var types = _ProductTypeRepository.FindAll(); ViewBag.Types = types; return(View(product)); }
public async Task <ServiceResponse> Get(int idProduct) { var sr = new ServiceResponse(); try { sr.Data = _mapper.Map <ProductDto>(await _repositoryProduct.Get(idProduct)); } catch (Exception ex) { sr.AddError(ex); } return(sr); }