예제 #1
0
        public utblBlog GetBlogByID(string BlogID)
        {
            utblBlog objDetails = new utblBlog();
            var      parBlogID  = new SqlParameter("@BlogID", BlogID);

            objDetails = objDB.Database.SqlQuery <utblBlog>("udspGetBlogByID @BlogID", parBlogID).FirstOrDefault();
            return(objDetails);
        }
예제 #2
0
        public string Edit(utblBlog model, string CreatedBy)
        {
            DateTime         dt                 = DateTime.Now;
            var              CurrentYear        = dt.ToString("yyyy");
            SPErrorViewModel objStatus          = new SPErrorViewModel();
            var              parBlogID          = new SqlParameter("@BlogID", model.BlogID);
            var              parBlogTitle       = new SqlParameter("@Title", model.BlogTitle);
            var              parBlogDescription = new SqlParameter("@Description", model.BlogDescription);
            var              parBlogContent     = new SqlParameter("@Content", model.BlogContent);
            var              parCreatedBy       = new SqlParameter("@CreatedBy", CreatedBy);
            var              parBlogFile        = new SqlParameter("@BlogFile", DBNull.Value);

            if (model.BlogFile != null)
            {
                parBlogFile = new SqlParameter("@BlogFile", model.BlogFile);
            }
            objStatus = objDB.Database.SqlQuery <SPErrorViewModel>("udspBlogUpdate @BlogID,@Title,@Description,@Content,@BlogFile,@CreatedBy", parBlogID, parBlogTitle, parBlogDescription, parBlogContent, parBlogFile, parCreatedBy).FirstOrDefault();
            return(objStatus.ErrorCode + objStatus.ErrorMessage);
        }