public bool CreateProperty(PropertyCreate model) { TenantService tenantService = new TenantService(_ownerId); Result LocationData = GetLocationData(model.Address); var entity = new Property { OwnerId = _ownerId, Address = model.Address, City = model.City, State = model.State, ApartmentNumber = model.ApartmentNumber, Rent = model.Rent, TenantId = model.TenantId, Longitude = LocationData.geometry.location.lng.ToString(), Latitude = LocationData.geometry.location.lat.ToString(), DateClaimed = DateTimeOffset.Now }; using (var ctx = new Landlord.Data.ApplicationDbContext()) { ctx.Properties.Add(entity); return(ctx.SaveChanges() == 1); } }
public async Task CreateProperty(Guid spaceId, PropertyCreate propertyCreate) { SetupHttpClient(); _logger.Information($"Creating Property: {JsonConvert.SerializeObject(propertyCreate, Formatting.Indented)}"); var content = JsonConvert.SerializeObject(propertyCreate); var response = await _httpClient.PostAsync($"spaces/{spaceId.ToString()}/properties", new StringContent(content, Encoding.UTF8, "application/json")); _logger.Information($"Creating Property Response: {response}"); }
public ActionResult Create(PropertyCreate model) { PropertyService svc = CreatePropertyService(); if (svc.CreateProperty(model)) { return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult Create(PropertyCreate model) { if (!ModelState.IsValid) { return(View(model)); } var service = EstablishPropertyService(); if (service.CreateProperty(model)) { return(RedirectToAction("Index")); } ModelState.AddModelError("", "Note could not be created."); return(View(model)); }
public IHttpActionResult Post(PropertyCreate property) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = CreatePropertyService(); if (!service.CreateProperty(property)) { return(InternalServerError()); } return(Ok()); }
public ActionResult Create(PropertyCreate model) { if (!ModelState.IsValid) { return(View(model)); } PropertyService service = CreatePropertyService(); if (service.CreateProperty(model)) { TempData["SaveResult"] = "Property has been created."; return(RedirectToAction("Index")); } ; return(View(model)); }
public ActionResult Create(PropertyCreate model) { if (!ModelState.IsValid) { return(View(model)); } var service = CreatePropertyService(); if (service.CreateProperty(model)) { return(RedirectToAction("Create", "Feature")); } ; return(View(model)); }
// Create Property public bool CreateProperty(PropertyCreate model) { var entity = new Property() { PropertyOwnerFirstName = model.PropertyOwnerFirstName, PropertyOwnerLastName = model.PropertyOwnerLastName, PropertyAddress = model.PropertyAddress, PropertyPhone = model.PropertyPhone, PropertyOwnerEmail = model.PropertyOwnerEmail }; using (var ctx = new ApplicationDbContext()) { ctx.Property.Add(entity); return(ctx.SaveChanges() == 1); } }
public ActionResult Create(PropertyCreate model) { if (!ModelState.IsValid) { return(View(model)); } var service = CreatePropertyService(); if (service.CreateProperty(model)) { TempData["SaveResult"] = "Our Property has been created."; return(RedirectToAction("Index")); } ModelState.AddModelError("", "Property could not be created."); return(View(model)); }
public bool CreateProperty(PropertyCreate model) { var entity = new Property() { UserID = _userId, Address = model.Address, Size = model.Size, Price = model.Price, Seller = model.Seller, TimeOnMarket = model.TimeOnMarket, PropertyType = model.PropertyType }; using (var ctx = new ApplicationDbContext()) { ctx.Properties.Add(entity); return(ctx.SaveChanges() == 1); } }
public bool CreateProperty(PropertyCreate model) { var entity = new Property() { //UserId=_userId.ToString(), PropertyID = model.PropertyID, Bedroom = model.Bedroom, Bath = model.Bath, ListedPrice = model.ListedPrice, SquareFeet = model.SquareFeet, AvailableNow = model.AvailableNow }; using (var ctx = new ApplicationDbContext()) { ctx.Prop.Add(entity); return(ctx.SaveChanges() == 1); } }
//CREATE PROPERTY public bool CreateProperty(PropertyCreate model) { var property = new Property() { OwnerId = model.OwnerId, Title = model.Title, Address = model.Address, NumOfBeds = model.NumOfBeds, Desc = model.Desc, WeekdayRate = model.WeekDayRate, WeekendRate = model.WeekendRate, Rating = model.Rating, PropertyLocation = model.PropertyLocation, }; using (var ctx = new ApplicationDbContext()) { ctx.Properties.Add(property); return(ctx.SaveChanges() == 1); } }