public async Task <IActionResult> PutReview([FromRoute] int id, [FromBody] Review review) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != review.review_id) { return(BadRequest()); } _context.Entry(review).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AlbumExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit([Bind(Include = "Id,PlantCommonName,PlantSciName,PlantPhotoPath,PlantType,PlantSpring,PlantSummer,PlantAutumn,PlantWinter,PlantDesc,PlantFlowersPath,PlantFlowerColors,PlantSunNeedPath,PlantWaterFrq,PlantPruningFrq,PlantFertilizerFrq,PlantMistFrq,PlantSoilSand,PlantSoilClay,PlantSoilLoom,PlantHabitat,PlantAnimal,PlantDroughtTol,PlantCompanion")] PlantSet plantSet) { if (ModelState.IsValid) { db.Entry(plantSet).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(plantSet)); }
public ActionResult Put(int id, [FromBody] Reviewer reviewer) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Entry(reviewer).State = Microsoft.EntityFrameworkCore.EntityState.Modified; db.SaveChanges(); return(NoContent()); }
public ActionResult Edit([Bind(Include = "Id,PlantId,UserId,PlantWaterFrq,PlantPruningFrq,PlantFertilizerFrq,PlantMistFrq,StartDate,EndDate,Active")] UserPlantSet userPlantSet) { if (ModelState.IsValid) { db.Entry(userPlantSet).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PlantId = new SelectList(db.PlantSet, "Id", "PlantCommonName", userPlantSet.PlantId); return(View(userPlantSet)); }
public ActionResult Edit([Bind(Include = "Id,PlantId,WeedCommonName,WeedSciName,WeedPhotoPath,WeedDesc")] WeedSet weedSet) { if (ModelState.IsValid) { db.Entry(weedSet).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PlantId = new SelectList(db.PlantSet, "Id", "PlantCommonName", weedSet.PlantId); return(View(weedSet)); }
public virtual void Update(T entity) { dbset.Attach(entity); dataContext.Entry(entity).State = EntityState.Modified; }