public ActionResult Edit(Guid id) { var property = _landlordService.GetPropertyDetails(id); var model = new PropertyAddEditModel(property); return View("EditProperty", model); }
public ActionResult Add() { var model = new PropertyAddEditModel() { Property = new PropertyModel(), Address = new AddressModel() }; return View("AddProperty", model); }
public ActionResult Add(PropertyAddEditModel model) { if (ModelState.IsValid) { var dto = model.ToDto(); try { var userId = _sessionDetails.User.UserId; var id = _landlordService.AddProperty(userId, dto); return RedirectToAction("View", id); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return View("AddProperty", model); } } else { return View("AddProperty", model); } }