Exemplo n.º 1
0
        public GenericResponse <Post> AddPost(Post post)
        {
            GenericResponse <Post> response = new GenericResponse <Post>();

            repo.Add(post);

            Post confirm = repo.Get(post.Id);

            //if (confirm != null &&
            //             confirm.PostTitle == post.PostTitle &&
            //             confirm.PostBody == post.PostBody &&
            //             confirm.PostCategory == post.PostCategory &&
            //             confirm.PostedDate == post.PostedDate &&
            //             confirm.PostImageFileName == post.PostImageFileName)
            //{
            response.Success = true;
            response.Payload = post;
            //}
            //else
            //{
            //	response.Success = false;
            //	response.Message = "ERROR : Post was not added to database.";
            //	response.Payload = post;
            //}

            return(response);
        }
Exemplo n.º 2
0
        public GenericResponse <StaticPage> AddStaticPagePage(StaticPage staticPage)
        {
            GenericResponse <StaticPage> response = new GenericResponse <StaticPage>();

            repo.Add(staticPage);

            StaticPage confirm = repo.GetAll().FirstOrDefault(s => s.StaticPageTitle == staticPage.StaticPageTitle &&
                                                              s.StaticPageContent == staticPage.StaticPageContent &&
                                                              s.StaticPageImageFileName == staticPage.StaticPageImageFileName);

            if (confirm != null && repo.GetAll().Contains(confirm))
            {
                response.Success = true;
                response.Payload = confirm;
            }
            else
            {
                response.Success = false;
                response.Message = "ERROR : Static Page was not entered into database.";
                response.Payload = staticPage;
            }

            return(response);
        }