public PropertyDTO(PropertyDTO copy) { Id = copy.Id; LandlordId = copy.LandlordId; Housenumber = copy.Housenumber; Street = copy.Street; Town = copy.Town; PostCode = copy.PostCode; AvailableFrom = copy.AvailableFrom; Status = copy.Status; }
public void UpdateProperty(PropertyDTO prop) { var original = dataContext.Properties.Single(ll => ll.PropertyId == prop.Id); original.AvailableFrom = prop.AvailableFrom; original.Housenumber = prop.Housenumber; original.PostCode = prop.PostCode; original.Status = prop.Status.ToString(); original.Street = prop.Street; original.Town = prop.Town; dataContext.SubmitChanges(); }
public int CreateProperty(PropertyDTO dto) { if (dto is null) { return(0); } var property = new Property() { AvailableFrom = dto.AvailableFrom, Housenumber = dto.Housenumber, LandlordId = dto.LandlordId, PostCode = dto.PostCode, Status = dto.Status.ToString(), Street = dto.Street, Town = dto.Town, }; dataContext.Properties.InsertOnSubmit(property); dataContext.SubmitChanges(); return(property.PropertyId); }