public ActionResult UnUsedBuildingProject(UnUsedBuilding model) { if (ModelState.IsValid) { var initial = RepositoryContext.Current.GetOne <Project>(t => t._id == model._id) as UnUsedBuilding; initial.Name = model.Name; initial.Description = model.Description; initial.AddressName = model.AddressName; initial.Region = model.Region; initial.Address = new Address { Lat = model.Address.Lat, Lng = model.Address.Lng }; initial.Area = model.Area; initial.BalancePrice = model.BalancePrice; initial.IsExclusion = model.IsExclusion; initial.IsRent = model.IsRent; initial.AreaBuilding = model.AreaBuilding; initial.Tags = model.Tags; try { ProjectStateManager.StateManagerFactory(initial, User.Identity.Name, Roles.GetRolesForUser(User.Identity.Name)).FillInformation(initial); return(RedirectToAction("Project", "BaseProject", new { id = model._id })); } catch (Exception ex) { ModelState.AddModelError("Name", ex.Message); } } return(View(model)); }
public ActionResult CreateUnUsedBuildingProject(UnUsedBuilding model) { if (ModelState.IsValid) { ProjectStateManager.StateManagerFactory(model, User.Identity.Name, Roles.GetRolesForUser(User.Identity.Name)).CreateProject(model); return(RedirectToAction("Project", "BaseProject", new { id = model._id })); } return(View(model)); }