public async Task <IActionResult> PutComment(int id, Comment comment) { if (id != comment.Id) { return(BadRequest()); } _context.Entry(comment).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CommentExists(id)) { return(NotFound()); } else { throw; } } return(CreatedAtAction("GetComment", new { id = comment.Id }, comment)); }
public IActionResult GetById(int id) { var comment = _context.Comments.Find(id); _context.Entry(comment).Collection(comment => comment.Replies).Load(); if (comment == null) { return(StatusCode(StatusCodes.Status404NotFound)); } return(StatusCode(StatusCodes.Status200OK, new JsonResult(comment))); }
public async Task <IActionResult> PutTopic(long id, Topic topic) { if (id != topic.Id) { return(BadRequest()); } _context.Entry(topic).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TopicExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit(Comment comment) { if (ModelState.IsValid) { Hitchhiker h1 = hdb.Hitchhikers.Where(h => h.Name == comment.Author).SingleOrDefault(); if (comment.Hitchhiker == false) { if (h1 != null) { hdb.Hitchhikers.RemoveRange(hdb.Hitchhikers.Where(c => c.PostID == h1.PostID)); } } else { if (h1 != null) { h1.Phone = comment.PhoneNumber; hdb.Entry(h1).State = EntityState.Modified; } else { h1 = new Hitchhiker() { Name = comment.Author, Phone = comment.PhoneNumber, PostID = comment.RefferedPost }; hdb.Hitchhikers.Add(h1); } } hdb.SaveChanges(); cdb.Entry(comment).State = EntityState.Modified; cdb.SaveChanges(); return(RedirectToAction("Index", "Users")); } return(RedirectToAction("Index", "Users")); }
public void Update(Note nts) { db.Entry(nts).State = EntityState.Modified; }
public void Update(Correction cors) { db.Entry(cors).State = EntityState.Modified; }
public void Update(TakeOff tf) { db.Entry(tf).State = EntityState.Modified; }
public void Update(RequestForSpecification rqsp) { db.Entry(rqsp).State = EntityState.Modified; }
public void Update(AnswerToRequestToTakeOff anrqtkof) { db.Entry(anrqtkof).State = EntityState.Modified; }
public void Update(RequestForTakeOff rqtf) { db.Entry(rqtf).State = EntityState.Modified; }
public void Update(CorrectionStatus crst) { db.Entry(crst).State = EntityState.Modified; }
public void Update(RequestForCorrection rqcr) { db.Entry(rqcr).State = EntityState.Modified; }
public void Update(Specification sps) { db.Entry(sps).State = EntityState.Modified; }
public void Update(NoteStatus ntst) { db.Entry(ntst).State = EntityState.Modified; }
public void Update(RequestForUpdateStatus rqup) { db.Entry(rqup).State = EntityState.Modified; }
public void Update(Additional addnls) { db.Entry(addnls).State = EntityState.Modified; }
public void Update(AnswerToRequestSpecification anrqsp) { db.Entry(anrqsp).State = EntityState.Modified; }
public void Update(TakeOffStatus tfst) { db.Entry(tfst).State = EntityState.Modified; }