public ActionResult AdvertiseCar(CarShopModel carShopModel) { try { carShopModel.Categorys = slh.GetAllParentCategories(); var childCategories = _carShopSystem.GetChildCategorysById(carShopModel.ParentCategoryId); carShopModel.ChildCategorys = childCategories.Select(x => new SelectListItem { Value = x.ChildCategoryId.ToString(), Text = x.ChildCategoryName }).ToList(); if (carShopModel != null) { var newCar = CarShopHelper.EntityToModel(carShopModel); if (carShopModel.Files != null && carShopModel.Files.Any(x => x != null)) { newCar.Files = UploadPictures(carShopModel).ToList(); } _carShopSystem.CreateNewCar(newCar); return(RedirectToAction("CarView")); } } catch (Exception e) { log.Error(e.ToString()); throw; } return(View(carShopModel)); }
public ActionResult EditCarAdvertisement(int id) { var EditCarInformation = _carShopSystem.AdvertismentInformation(id); var transformation = CarShopHelper.ModelToEntity(EditCarInformation); return(View(transformation)); }
public ActionResult SearchResult(string searchItem) { if (!string.IsNullOrEmpty(searchItem)) { var search = _carShopSystem.SearchItem(searchItem); var Transformed = CarShopHelper.Transform(search); return(View("SearchResult", Transformed)); } else { return(View("CarView")); } }
public ActionResult EditCarAdvertisement(CarShopModel carShopModel) { try { if (carShopModel != null) { _carShopSystem.EditCar(CarShopHelper.EntityToModel(carShopModel)); } } catch (Exception) { throw; } return(RedirectToAction("CarView")); }
public ActionResult CarInformation(int id) { try { var details = _carShopSystem.AdvertismentInformation(id); details.Files = _carShopSystem.GetPictures(details.AdvertisementId).ToList(); var transformation = CarShopHelper.ModelToEntity(details); if (transformation == null) { return(View()); } return(View(transformation)); } catch (Exception e) { throw; } }
public ActionResult FeaturedCars(CarShopModel carModel, string Id) { try { //var carModel = new CarShopModel(); var carList = _carShopSystem.ListExistingCars(); //var carsToBeFeatured = _carShopSystem.GetFeaturedCars(carModel.IsFeatured); var advertisementId = carList.Select(x => x.AdvertisementId).ToList(); var pictures = _carShopSystem.GetFeaturedPictures(advertisementId); //carsToBeFeatured.Select(x => x.Files == pictures); carList.Where(x => x.Files == pictures); var transformed = CarShopHelper.Transform(carList); return(PartialView(transformed)); } catch (Exception e) { log.Error(e.ToString()); throw; } }
public ActionResult CarView() { var transformed = CarShopHelper.Transform(_carShopSystem.ListExistingCars()); return(View(transformed)); }