Exemplo n.º 1
0
        public async Task <Models.InnovateDb.Vote> CancelVoteChanges(Models.InnovateDb.Vote item)
        {
            var entity = context.Entry(item);

            entity.CurrentValues.SetValues(entity.OriginalValues);
            entity.State = EntityState.Unchanged;

            return(item);
        }
Exemplo n.º 2
0
        public async Task <Models.InnovateDb.Vote> CreateVote(Models.InnovateDb.Vote vote)
        {
            OnVoteCreated(vote);

            context.Votes.Add(vote);
            context.SaveChanges();

            OnAfterVoteCreated(vote);

            return(vote);
        }
Exemplo n.º 3
0
        public async Task <Models.InnovateDb.Vote> UpdateVote(int?voteid, Models.InnovateDb.Vote vote)
        {
            OnVoteUpdated(vote);

            var item = context.Votes
                       .Where(i => i.voteid == voteid)
                       .FirstOrDefault();

            if (item == null)
            {
                throw new Exception("Item no longer available");
            }
            var entry = context.Entry(item);

            entry.CurrentValues.SetValues(vote);
            entry.State = EntityState.Modified;
            context.SaveChanges();

            OnAfterVoteUpdated(vote);

            return(vote);
        }
Exemplo n.º 4
0
 partial void OnAfterVoteUpdated(Models.InnovateDb.Vote item);
Exemplo n.º 5
0
 partial void OnVoteGet(Models.InnovateDb.Vote item);
Exemplo n.º 6
0
 partial void OnVoteDeleted(Models.InnovateDb.Vote item);