public IActionResult UpdateRequestDetail(int sellerId, int productTypeId) { ViewData[GlobalViewBagKeys.ECommerceService] = eCommerce; ProductTypeUpdateRequestView updateRequest = eCommerce.GetProductTypeUpdateRequestBy(sellerId, productTypeId); return(updateRequest != null?View(updateRequest) : (IActionResult)NotFound()); }
static void Main(string[] args) { //ApplicationDbContext context = new ApplicationDbContext(); IUnitOfWork uow = new UnitOfWork(); ECommerceService eCommerce = new ECommerceService(uow); var x = eCommerce.GetProductTypeUpdateRequestBy(1, 8); Console.WriteLine(x.Descriptions); Console.WriteLine("Done."); Console.ReadKey(); }
public IActionResult Index(int productTypeId) { SellerView seller = loginPersistence.PersistLogin(); var errors = new List <string>(); ProductTypeView productType = eCommerce.GetProductTypeBy(productTypeId); if (productType != null) { if (productType.Status == ProductTypeStatus.Locked) { errors.Add("Product is unavailable at the moment"); } } else { errors.Add("Could not found product type"); } if (errors.Any()) { ViewData[GlobalViewBagKeys.Errors] = errors; return(RedirectToAction("SelectProductType")); } ViewData[GlobalViewBagKeys.ECommerceService] = eCommerce; ProductTypeUpdateRequestView updateRequest = eCommerce.GetProductTypeUpdateRequestBy(int.Parse(seller.Id), int.Parse(productType.Id)); ProductTypeUpdateRequestAddModel addModel = new ProductTypeUpdateRequestAddModel(); if (updateRequest != null) { if (updateRequest.CategoryId != null) { addModel.CategoryId = int.Parse(updateRequest.CategoryId); } addModel.Name = updateRequest.Name; addModel.ProductTypeId = int.Parse(productType.Id); addModel.Descriptions = updateRequest.Descriptions; } else { addModel.CategoryId = int.Parse(productType.CategoryId); addModel.Name = productType.Name; addModel.ProductTypeId = int.Parse(productType.Id); } return(View(addModel)); }