public async Task <IHttpActionResult> PutCommentsModal(int id, CommentsModal commentsModal) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != commentsModal.CommentId) { return(BadRequest()); } db.Entry(commentsModal).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CommentsModalExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <ActionResult> Create([Bind(Include = "Id,Name,Surname")] Person person) { if (ModelState.IsValid) { db.People.Add(person); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(person)); }