Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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());
        }
Exemplo n.º 3
0
        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());
        }
Exemplo n.º 4
0
 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));
 }
Exemplo n.º 5
0
 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));
 }
Exemplo n.º 6
0
        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));
        }
Exemplo n.º 7
0
 public void Update(T obj)
 {
     table.Attach(obj);
     _context.Entry(obj).State = EntityState.Modified;
 }