public ActionResult Create() { PropertyCreateModel model = new PropertyCreateModel(); model.StepsAvailable = GetStepsAvailable(null); var result = this.propertyAdapter.GetInfoForNewProperty(User.Identity.Name); if (result.StatusCode != 200) return HttpNotFound(); model.Input = result.Result; return View(model); }
public ActionResult Create(PropertyCreateInputModel input, string command) { if (ModelState.IsValid) { var result = this.propertyAdapter.CreateProperty(input.ToBuilding()); if (result.StatusCode == 200) { if(command == "list") return RedirectToAction("list", new { id = result.Result.BuildingId }); if (command == "save") return RedirectToAction("manage", new { id = result.Result.BuildingId }); } HandleErrors(result); } PropertyCreateModel model = new PropertyCreateModel(input); return View(model); }
public ActionResult Create() { PropertyCreateModel model = new PropertyCreateModel(); return View(model); }
public ActionResult Create(Building input) { if (ModelState.IsValid) { // set some defaults for terms on create input.LeaseLength = LeaseLength.Year; input.ArePetsAllowed = true; var result = this.propertyAdapter.CreateBuilding(User.Identity.Name, input); if (result.StatusCode == 200) return RedirectToAction("terms", new { id = result.Result.BuildingId }); HandleErrors(result); } // validate var freshBuilding = this.propertyAdapter.GetInfoForNewProperty(User.Identity.Name); if (freshBuilding.StatusCode != 200) return HttpNotFound(); // add missing info if (input.CustomAmenities == null) input.CustomAmenities = freshBuilding.Result.CustomAmenities; if (input.ContactInfo == null) input.ContactInfo = freshBuilding.Result.ContactInfo; input.User = freshBuilding.Result.User; // return PropertyCreateModel model = new PropertyCreateModel(); model.Input = input; model.StepsAvailable = GetStepsAvailable(freshBuilding.Result); return View(model); }