public void AddProperty(PropertyViewModel property, Guid ownerId) { var newProperty = AutoMapper.Mapper.Map<PropertyViewModel, Core.Model.Property.Property>(property); var user = _userRepository.Get(ownerId); newProperty.Owner = user; _propertyRepository.SaveOrUpdate(newProperty); _propertyRepository.DbContext.CommitChanges(); }
public ActionResult AddProperty(PropertyViewModel property) { _propertyService.AddProperty(property, new Guid(User.Identity.Name)); return RedirectToAction("Index", "Default"); }