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); }
public async Task <Models.InnovateDb.Vote> CreateVote(Models.InnovateDb.Vote vote) { OnVoteCreated(vote); context.Votes.Add(vote); context.SaveChanges(); OnAfterVoteCreated(vote); return(vote); }
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); }
partial void OnAfterVoteUpdated(Models.InnovateDb.Vote item);
partial void OnVoteGet(Models.InnovateDb.Vote item);
partial void OnVoteDeleted(Models.InnovateDb.Vote item);