public ActionResult Edit(PropertyEditInputModel input, string command) { if (ModelState.IsValid) { var request = this.propertyAdapter.UpdateProperty(input.ToBuilding()); if (request.StatusCode == 200) { if (command == "save") return RedirectToAction("manage", new { id = request.Result.BuildingId }); if (command == "list") return RedirectToAction("list", new { id = request.Result.BuildingId }); HandleErrors(request); } } PropertyEditModel model = new PropertyEditModel(input); return View(model); }
public ActionResult Edit(long id) { var request = this.propertyAdapter.GetProperty(id, User.Identity.Name); if (request.StatusCode != 200) return this.NotFoundException(); PropertyEditModel model = new PropertyEditModel( new PropertyEditInputModel(request.Result) ); return View(model); }
public ActionResult Edit(Building input) { if (ModelState.IsValid) { var status = this.propertyAdapter.UpdatePropertyListingInfo(User.Identity.Name, input); if (status.StatusCode == 200) return RedirectToAction("terms", new { id = input.BuildingId }); HandleErrors(status); } var buildingVal = this.propertyAdapter.GetPropertyListingInfo(input.BuildingId, User.Identity.Name); if (buildingVal.StatusCode != 200) return HttpNotFound(); // load user since it was not posted input.User = buildingVal.Result.User; PropertyEditModel model = new PropertyEditModel() { Input = input, StepsAvailable = GetStepsAvailable(buildingVal.Result) }; if (input.CustomAmenities == null) input.CustomAmenities = new List<CustomAmenity>(); return View(model); }
public ActionResult Edit(long id) { var status = this.propertyAdapter.GetPropertyListingInfo(id, User.Identity.Name); if (status.StatusCode != 200) return HttpNotFound(); PropertyEditModel model = new PropertyEditModel(); model.Input = status.Result; model.StepsAvailable = GetStepsAvailable(status.Result); return View(model); }
public ActionResult Edit(PropertyEditInputModel input, string command) { if (ModelState.IsValid) { var request = this.propertyAdapter.UpdateProperty(input.ToBuilding()); if (request.StatusCode == 200) { if (command == "save") { string uri = string.Format( "{0}/dashboard/property/manage/{1}", Config.Hostname, request.Result.BuildingId ); return Redirect(uri); } if (command == "list") return RedirectToAction("list", new { id = request.Result.BuildingId }); HandleErrors(request); } } PropertyEditModel model = new PropertyEditModel(input); return View(model); }
public ActionResult Edit(long id, Guid? token) { if (!User.Identity.IsAuthenticated && token.HasValue) { var user = authAdapter.ValidateAuthToken(token.Value); if (user.StatusCode == 200) { CustomAuthentication.SetAuthCookie(user.Result.Username, user.Result.UserId, true); return RedirectToAction("edit"); } } var request = this.propertyAdapter.GetProperty(id, User.Identity.Name); if (request.StatusCode != 200) return this.NotFoundException(); PropertyEditModel model = new PropertyEditModel( new PropertyEditInputModel(request.Result) ); return View(model); }