Esempio n. 1
0
        // GET: /Tutorial/Details/5
        public ActionResult Details(int?id)
        {
            var comment = from s in db.Comments.Include(t => t.Tutorial).Include(f => f.User.Files)
                          select s;

            TutorialComment tutorialcomment = new TutorialComment();

            tutorialcomment.Comments = comment;

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Tutorial tutorial = db.Tutorials.Find(id);

            tutorialcomment.Tutorial = tutorial;

            if (tutorialcomment.Tutorial == null)
            {
                return(HttpNotFound());
            }

            return(View(tutorialcomment));
        }
Esempio n. 2
0
        public ActionResult Details([Bind(Include = "ID,Text,DateTime")] Comment comment, int?id)
        {
            TutorialComment tutorialcomment = new TutorialComment();

            tutorialcomment.Comment = comment;

            if (ModelState.IsValid)
            {
                string userid      = User.Identity.GetUserId();
                var    currentuser = db.Users.SingleOrDefault(u => u.Id == userid);

                var currentutorial = db.Tutorials.SingleOrDefault(v => v.ID == id);


                tutorialcomment.Comment.User     = currentuser;
                tutorialcomment.Comment.Tutorial = currentutorial;
                tutorialcomment.Comment.DateTime = DateTime.Now;

                db.Comments.Add(tutorialcomment.Comment);
                db.SaveChanges();
                return(RedirectToAction("Details"));
            }

            return(View(tutorialcomment));
        }
Esempio n. 3
0
        public ActionResult DeleteComment(int id)
        {
            if (IsAdmin)
            {
                TutorialComment c = model.TutorialComments.Where(x => x.ID == id).First();

                model.TutorialComments.DeleteObject(c);
                model.SaveChanges();
            }

            return(RedirectToAction("index"));
        }
Esempio n. 4
0
        public ActionResult Comment(int id, string name, string email, string body)
        {
            TutorialPost    post    = GetPost(id);
            TutorialComment comment = new TutorialComment();

            comment.TutorialPost = post;
            comment.DateTime     = DateTime.Now;
            comment.Name         = name;
            comment.Email        = email;
            comment.Body         = body;
            model.AddToTutorialComments(comment);
            model.SaveChanges();
            return(RedirectToAction("Details", new { id = id }));
        }
Esempio n. 5
0
 void Update()
 {
     if (loadScene != null)
     {
         loadAmount = Mathf.MoveTowards(loadAmount, loadScene.progress, Time.deltaTime);
         Camera.main.GetComponent <ColorCorrectionCurves>().redChannel.MoveKey(0, new Keyframe(0, loadAmount * 1.1f));
         Camera.main.GetComponent <ColorCorrectionCurves>().greenChannel.MoveKey(0, new Keyframe(0, loadAmount * 1.1f));
         Camera.main.GetComponent <ColorCorrectionCurves>().blueChannel.MoveKey(0, new Keyframe(0, loadAmount * 1.1f));
         Camera.main.GetComponent <ColorCorrectionCurves>().UpdateParameters();
         if (loadAmount >= 0.9f)
         {
             TutorialComment.FixCutoffFreq();
             loadScene.allowSceneActivation = true;
         }
     }
 }