public async Task <IActionResult> Edit(int id, [Bind("id,MetroArea,YearBuilt,insertionDate,Creator,RecentEdit")] REProperty rEProperty) { if (id != rEProperty.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(rEProperty); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!REPropertyExists(rEProperty.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(rEProperty)); }
public async Task <IActionResult> PutREProperty([FromRoute] long id, [FromBody] REProperty rEProperty) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != rEProperty.Id) { return(BadRequest()); } _context.Entry(rEProperty).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!REPropertyExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <PropertyDto> Create(REProperty prop) { _context.Properties.Add(prop); await _context.SaveChangesAsync(); return(new PropertyDto { Id = prop.Id, Address = prop.Address, AccquisitionDate = prop.AccquisitionDate }); }
public async Task <IActionResult> Create([Bind("id,MetroArea,YearBuilt,insertionDate,Creator,RecentEdit")] REProperty rEProperty) { if (ModelState.IsValid) { _context.Add(rEProperty); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(rEProperty)); }
private void Add_Property(REProperty property) { int y = mainPA.Controls.Count > 0 ? mainPA.Controls[mainPA.Controls.Count - 1].Location.Y + mainPA.Controls[mainPA.Controls.Count - 1].Height : 0; property.Control.Location = new Point(0, y + 4); //property.Control.Size = new Size(Width, 171); property.Reshape(mainPA.Width - 19, property.Control.Height); mainPA.Controls.Add(property.Control); }
public async Task <IActionResult> PostREProperty([FromBody] REProperty rEProperty) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.ReProperties.Add(rEProperty); await _context.SaveChangesAsync(); return(CreatedAtAction("GetREProperty", new { id = rEProperty.Id }, rEProperty)); }
public async Task <ActionResult <PropertyDto> > CreateProperty(PropertyDto propDto) { var prop = new REProperty { FromUserName = "", Address = propDto.Address, City = propDto.City, State = propDto.State, Zip = propDto.Zip, AccquisitionDate = propDto.AccquisitionDate, AccquisitionValue = propDto.AccquisitionValue, CreatedDate = DateTime.Now }; _context.Properties.Add(prop); return(Ok(await _context.SaveChangesAsync())); //return Ok(await _repository.CreateAsync(prop)); }
public void Update(REProperty prop) { _context.Entry(prop).State = Microsoft.EntityFrameworkCore.EntityState.Modified; }