Пример #1
0
        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);
            }
        }