public ActionResult Create(PropertySpaceFormViewModel createPropertySpace) { var propertySpace = Mapper.Map <PropertySpaceFormViewModel, PropertySpace>(createPropertySpace); if (ModelState.IsValid) { propertySpaceService.CreatePropertySpace(propertySpace); TempData.Add("flash", new FlashSuccessViewModel("Your property space has been created successfully.")); return(RedirectToAction("Edit", new { id = propertySpace.Id })); } else { TempData.Add("flash", new FlashDangerViewModel("There was an error saving property space")); } return(View(createPropertySpace)); }
// GET: Admin/Property/Create public ActionResult Create(int id) { if (id == 0) { TempData.Add("flash", new FlashDangerViewModel("A valid property listing type was not selected")); return(RedirectToAction("Index", "Property", null)); } var property = propertyService.GetProperty(id); if (property == null) { TempData.Add("flash", new FlashDangerViewModel("A valid property was not selected")); return(RedirectToAction("Index", "Property", null)); } var createPropertySpace = new PropertySpaceFormViewModel(); createPropertySpace.PropertyId = id; ViewBag.PropertyListType = property.PropertyListType; return(View(createPropertySpace)); }