Exemple #1
0
        //////////////////////NONE INTERFACE METHOD////////////////////////////////


        public Answer CreateAnswer(int post_id, int parent_id)
        {
            try
            {
                var a = new Answer()
                {
                    PostId         = post_id, ParentId = parent_id,
                    AcceptedAnswer = 0, Editable = 0
                };
                _context.Answer.Add(a);
                _context.SaveChanges();
                return(a);
            }
            catch (Exception ex)
            {
                //UnitOfWork.WriteErrorLog(ex);
            }
            return(null);
        }
        //////////////////////NONE INTERFACE METHOD////////////////////////////////


        public Note CreateNote(int userId, int postId, string body)
        {
            try
            {
                var a = new Note()
                {
                    UserId       = userId,
                    PostId       = postId,
                    CreationDate = DateTime.Now,
                    Body         = body
                };
                _context.Note.Add(a);
                _context.SaveChanges();
                return(a);
            }
            catch (Exception ex)
            {
                //UnitOfWork.WriteErrorLog(ex);
            }
            return(null);
        }
Exemple #3
0
        //////////////////////NONE INTERFACE METHOD////////////////////////////////


        public Post CreatePost(string title, string body, int score, int userId, DateTime creationDate, string PostType)
        {
            try
            {
                var p = new Post()
                {
                    Title        = title,
                    Body         = body,
                    Score        = 0,
                    UserId       = userId,
                    CreationDate = creationDate,
                    PostType     = PostType
                };
                _context.Post.Add(p);
                _context.SaveChanges();
                return(p);
            }
            catch (Exception ex)
            {
                //UnitOfWork.WriteErrorLog(ex);
            }
            return(null);
        }