public ActionResult Products(int categoryId) { var category = IntEngDataSource.GetCategory(categoryId); if (category == null) { return(HttpNotFound()); } return(View(category)); }
public ActionResult Results(string q, string cid, string uplb, string upub) { var searchInput = SearchInputModel.TryCreate(q, cid, uplb, upub); var products = IntEngDataSource.Search(searchInput.Query, searchInput.CategoryId, searchInput.UnitPriceLowerBound, searchInput.UnitPriceUpperBound); return(View(new SearchResultModel { Input = searchInput, Results = products })); }
public ActionResult Edit(int productId, string returnUrl) { ViewBag.ReturnUrl = returnUrl ?? Url.RouteUrl("List"); ViewBag.HasError = false; var product = IntEngDataSource.GetProduct(productId); if (product == null) { return(HttpNotFound()); } return(View(product)); }
public ActionResult Remove(int productId, string returnUrl) { ViewBag.ReturnUrl = returnUrl ?? Url.RouteUrl("List"); var product = IntEngDataSource.GetProduct(productId); if (product == null) { return(HttpNotFound()); } if (_intEngDatabase.ExecuteDelete("Products", "Id", product.Id)) { //return View("_Success", ViewBag.ReturnUrl); return(Redirect(ViewBag.ReturnUrl)); } ModelState.AddModelError(string.Empty, "خطایی رخ داده است."); ViewBag.HasError = true; return(RedirectToAction("List")); }
public ActionResult Details(int categoryId, int productId) { var category = IntEngDataSource.GetCategory(categoryId); if (category == null) { return(HttpNotFound()); } var product = IntEngDataSource.GetProduct(productId); if (product == null) { return(HttpNotFound()); } if (product.Category.Id != category.Id) { return(HttpNotFound()); } return(View(product)); }
public ActionResult All() { return(View(IntEngDataSource.GetAllProducts())); }
public ActionResult List() { ViewBag.HasError = false; return(View(IntEngDataSource.GetAllProducts())); }