public async Task <ActionResult> DeleteConfirmed(int id) { Models.Postgres.Apartment tempApartment = await db.Apartments.FindAsync(id); db.Apartments.Remove(tempApartment); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Create([Bind(Include = "Id,Name,Author,Price,Phone,Description,DateCreated,DateActualTo,IsActive,IsDonated,DonateDueDate,InternalComment,ClientId,ParsingSource,ShortId,SourceURL,mainPhotoUrl,photosListUrls,phoneImgURL")] Models.Postgres.Apartment tempApartment) { if (ModelState.IsValid) { db.Apartments.Add(tempApartment); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(tempApartment)); }
// GET: TempApartments/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Models.Postgres.Apartment tempApartment = await db.Apartments.FindAsync(id); if (tempApartment == null) { return(HttpNotFound()); } return(View(tempApartment)); }