public void AddProperty(HomeAwayPropertyModel model) { RequestService service = new RequestService(); service.AddProperty(model); }
public bool AddProperty(HomeAwayPropertyModel model) { HomeAwayProperty request = null; using (ipl_userprofilerEntities entity = new ipl_userprofilerEntities()) { if (model.Id == 0) { request = new HomeAwayProperty(); entity.HomeAwayProperties.Add(request); request.AddedAt = DateTime.Now; } else { request = entity.HomeAwayProperties.FirstOrDefault(res => res.Id == model.Id); } request.Accomodates = model.Accomodates; request.Address1 = model.Address1; request.Address2 = model.Address2; request.Bedrooms = model.Bedrooms; request.Beds = model.Beds; request.City = model.City; request.Country = model.Country; request.Description = model.Description; request.Locality = model.City; request.Name = model.Name; request.NightPrice = model.NightPrice; request.State = model.State; request.Type = model.Type; request.WeekPrice = model.WeekPrice; request.Zip = model.Zip; entity.SaveChanges(); } return true; }