Esempio n. 1
0
 public void Delete(int id)
 {
     var poll = new PollDa(databasecontext);
     if (id > 0)
     {
         var currentPoll = GetById(id);
         poll.Delete(currentPoll);
     }
 }
Esempio n. 2
0
        public Poll Save(int Id, string Title, int PollType, DateTime StartDate, DateTime EndDate, bool Closed)
        {
            var poll = Id > 0 ? GetById(Id) : new Poll();

            poll.Title = Title;
            poll.PollType = PollType;
            poll.StartDate = StartDate;
            poll.EndDate = EndDate;
            poll.Closed = Closed;

            var pollDa = new PollDa(databasecontext);

            //if new
            if (Id < 1) poll = pollDa.Add(poll);
            //update
            else poll= pollDa.Update(poll);

            return poll;
        }