Example #1
0
        public void GetTutorialsById()
        {
            TutorialsService tutorialsCRUD = new TutorialsService();
            Tutorials        tutorials     = tutorialsCRUD.GetTutorialsById("1394f8b1-e734-4231-8c52-d1cba8e2fbf7");

            Assert.IsNotNull(tutorials);
        }
Example #2
0
        public void TutorialsDelete()
        {
            TutorialsService tutorialsCRUD = new TutorialsService();

            tutorialsCRUD.Delete("ad6b3dbb-f9d2-4d38-b601-42cb36a1120a");
            Assert.IsNull(tutorialsCRUD.GetTutorialsById("ad6b3dbb-f9d2-4d38-b601-42cb36a1120a"));
        }
Example #3
0
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Tutorials      tutorials      = tutorialsCRUD.GetTutorialsById(id);
            TutorialsModel tutorialsModel = tutorials.ToModel();

            return(View(tutorialsModel));
        }
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            if (Session[id] == null)
            {
                HttpContext.Session.Add(id, id);
                pcs.PageViewDetails(id);
            }
            ViewBag.PageViewCount = pcs.GetPageViewCountByResourceID(id);
            Tutorials tutorials = tutorialsCRUD.GetTutorialsById(id);

            return(View(tutorials.ToModel()));
        }
Example #5
0
        public void TutorialsCreate()
        {
            TutorialsService tutorialsCRUD = new TutorialsService();
            Tutorials        tutorials     = new Tutorials();

            tutorials.TutorialsID = Guid.NewGuid().ToString();
            tutorials.Title       = "测试";
            tutorials.Content     = ReadFile("aa.txt");
            tutorials.CreateAt    = DateTime.Now;
            tutorials.Disc        = "Disc 测试";
            tutorials.Notes       = "Notes 测试";
            User user = new User();

            user.UserID    = "1f1c4189-3792-4a91-8d08-c0d04e18a0ae";
            tutorials.user = user;
            tutorialsCRUD.Create(tutorials);
            Assert.IsNotNull(tutorialsCRUD.GetTutorialsById(tutorials.TutorialsID));
        }