public TwitterAnalysisModel GetTwitterAnalysis(int id) { var result = db.Analysis.First(a => a.AnalysisId == id); db.Entry(result).Collection(p => p.Phrases).Load(); foreach (var phrase in result.Phrases) { db.Entry(phrase).Collection(d => d.Details).Load(); } return(result); }
public async Task <IActionResult> PutUser(long id, User user) { if (id != user.Id) { return(BadRequest()); } _context.Entry(user).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutTwitter(long id, Twitter twitter) { if (id != twitter.Id) { return(BadRequest()); } const int MaxLength = 10; if (twitter.Content.Length > MaxLength) { return(BadRequest()); } _context.Entry(twitter).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TwitterExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit([Bind(Include = "ID,Name,Handle")] User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(user)); }
public ActionResult Edit([Bind(Include = "TweetID,Text,UserID,TweetDate")] Tweet tweet) { if (ModelState.IsValid) { db.Entry(tweet).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.UserID = new SelectList(db.Users, "ID", "Name", tweet.UserID); return(View(tweet)); }
public ActionResult Edit([Bind(Include = "Id,AuthorId,Description,TakenDate")] Tweet tweet) { if (ModelState.IsValid) { db.Entry(tweet).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AuthorId = new SelectList(db.Users, "Id", "FullName", tweet.AuthorId); return(View(tweet)); }
public void Update(T obj) { table.Attach(obj); _context.Entry(obj).State = EntityState.Modified; }