public ActionResult Terms(PropertyTermsInputModel input) { if (ModelState.IsValid) { var status = this.propertyAdapter.UpdatePropertyTerms(User.Identity.Name, input.ToBuilding()); if (status.StatusCode == 200) return RedirectToAction("promote", new { id = input.BuildingId }); HandleErrors(status); } var buildingVal = this.propertyAdapter.GetProperty(input.BuildingId, User.Identity.Name); if (buildingVal.StatusCode != 200) return this.NotFoundException(); // return the model back with model state errors PropertyTermsModel model = new PropertyTermsModel() { Input = input, StepsAvailable = GetStepsAvailable(buildingVal.Result) }; return View(model); }
public ActionResult Terms(PropertyTermsInputModel input) { if (ModelState.IsValid) { // rebuild building Building building = new Building() { BuildingId = input.BuildingId, IsBackgroundCheckRequired = input.IsBackgroundCheckRequired, IsCreditCheckRequired = input.IsCreditCheckRequired, Price = input.Price, Deposit = (input.Deposit.HasValue) ? input.Deposit.Value : decimal.Zero, RefundableDeposit = (input.RefundableDeposit.HasValue) ? input.RefundableDeposit.Value : decimal.Zero, DateAvailableUtc = input.DateAvailableUtc, LeaseLengthCode = input.LeaseLengthCode, IsSmokingAllowed = input.IsSmokingAllowed, ArePetsAllowed = input.ArePetsAllowed }; // pets are not allowed so no fee can be charged if (!input.ArePetsAllowed) building.PetFee = decimal.Zero; else building.PetFee = (input.PetFee.HasValue) ? input.PetFee.Value : decimal.Zero; var status = this.propertyAdapter.UpdatePropertyTerms(User.Identity.Name, building); if (status.StatusCode == 200) return RedirectToAction("promote", new { id = input.BuildingId }); HandleErrors(status); } var buildingVal = this.propertyAdapter.GetProperty(input.BuildingId, User.Identity.Name); if (buildingVal.StatusCode != 200) return HttpNotFound(); // return the model back with model state errors PropertyTermsModel model = new PropertyTermsModel() { Input = input, StepsAvailable = GetStepsAvailable(buildingVal.Result) }; return View(model); }
public ActionResult Terms(long id) { var status = this.propertyAdapter.GetProperty(id, User.Identity.Name); if (status.StatusCode != 200) return this.NotFoundException(); PropertyTermsModel model = new PropertyTermsModel(); model.Input = new PropertyTermsInputModel(status.Result); model.StepsAvailable = GetStepsAvailable(status.Result); return View(model); }
public ActionResult Terms(long id) { var status = this.propertyAdapter.GetProperty(id, User.Identity.Name); if (status.StatusCode != 200) return HttpNotFound(); Building building = status.Result; PropertyTermsModel model = new PropertyTermsModel(); model.StepsAvailable = GetStepsAvailable(status.Result); model.Input = new PropertyTermsInputModel() { BuildingId = building.BuildingId, IsBackgroundCheckRequired = building.IsBackgroundCheckRequired, IsCreditCheckRequired = building.IsCreditCheckRequired, Price = building.Price, Deposit = building.Deposit, RefundableDeposit = building.RefundableDeposit, DateAvailableUtc = building.DateAvailableUtc, LeaseLengthCode = building.LeaseLengthCode, IsSmokingAllowed = building.IsSmokingAllowed, ArePetsAllowed = building.ArePetsAllowed, PetFee = building.PetFee }; return View(model); }