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)); }