public IHttpActionResult PutCalendar(int id, Calendar calendar) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != calendar.ID) { return(BadRequest()); } db.Entry(calendar).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CalendarExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IActionResult> PutTblEvent(int id, [FromBody] TblEvent tblEvent) { if (id != tblEvent.Id) { return(BadRequest()); } _context.Entry(tblEvent).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TblEventExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit([Bind(Include = "ID,Title,StartDate,EndDate")] Calendar calendar) { if (ModelState.IsValid) { db.Entry(calendar).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(calendar)); }