Esempio n. 1
0
        public void SaveNugget(Nugget nugget)
        {
            if (nugget.ID == 0)
            {
                nugget.Created = DateTime.Now;
                _dbContext.Nuggets.Add(nugget);

                ICommentsRepository comments = new CommentsRepository(_dbContext);
                comments.SaveCommentEvent += new SaveCommentHandler(comments_AddCommentEvent);
            }

            _dbContext.SaveChanges();
        }
Esempio n. 2
0
        public Nugget SaveNugget(string nuggetTitle, string nuggetDescription, long memberID)
        {
            var newNugget = new Nugget
                                {
                                    Title = nuggetTitle,
                                    Description = nuggetDescription,
                                    MemberID = memberID
                                };

            _repository.SaveNugget(newNugget);

            return newNugget;
        }
Esempio n. 3
0
        public void DeleteNugget(Nugget nugget)
        {
            _dbContext.Nuggets.Remove(nugget);

            _dbContext.SaveChanges();
        }
Esempio n. 4
0
 public NuggetViewModel(Nugget nugget)
 {
     Description = nugget.Description;
     Title = nugget.Title;
 }
Esempio n. 5
0
 public void SaveNugget(Nugget nugget)
 {
     _repository.SaveNugget(nugget);
 }