public void Delete(int id) { var round = new PollVoteDa(databasecontext); if (id > 0) { var currentRound = GetById(id); round.Delete(currentRound); } }
public PollVote Save(int id, int PollId, int WorkId, string IPAddress, DateTime TimeVoted) { var pollVote = id > 0 ? GetById(id) : new PollVote(); pollVote.PollId = PollId; pollVote.WorkId = WorkId; pollVote.IPAddress = IPAddress; pollVote.TimeVoted = TimeVoted; var pollVoteDa = new PollVoteDa(databasecontext); //if new if (id < 1) pollVote = pollVoteDa.Add(pollVote); //update else pollVote = pollVoteDa.Update(pollVote); return pollVote; }