public async Task <IActionResult> Edit(int id, [Bind("id,body,email,date_time")] Chirper chirper)
        {
            if (id != chirper.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(chirper);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ChirperExists(chirper.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(chirper));
        }
        public void ResetPosition()
        {
            ChirperUtils.CollapseChirperInstantly();

            Chirper.builtinChirperPosition = DefaultPosition;
            Chirper.SetBuiltinChirperAnchor(ChirperAnchor.TopCenter);
        }
        public async Task <IActionResult> Create([Bind("id,body,email,date_time")] Chirper chirper)
        {
            if (ModelState.IsValid)
            {
                _context.Add(chirper);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(chirper));
        }
Beispiel #4
0
 void UpdateMyFollowers(Chirper chirper, Follower follower, Action<MyFollowers, Follower> update)
 {
     var myFollowers = _myFollowersRepository.GetById(chirper.ChirperId);
     update.Invoke(myFollowers,follower);
     _myFollowersRepository.Update(myFollowers);
 }
Beispiel #5
0
 void UpdateMyFollows(Follower follower, Chirper chirper, Action<MyFollows,Chirper> update)
 {
     var myFollows = _myFollowsRepository.GetById(follower.FollowerId);
     update.Invoke(myFollows,chirper);
     _myFollowsRepository.Update(myFollows);
 }
 public void UpdateChirperAnchor()
 {
     Chirper.SetBuiltinChirperAnchor(CalculateAnchor());
 }
Beispiel #7
0
 public void RemoveFollow(Chirper follow)
 {
     if (_following.Contains(follow))
         _following.Remove(follow);
 }
Beispiel #8
0
 public void AddFollow(Chirper follow)
 {
     if (!_following.Contains(follow))
         _following.Add(follow);
 }