Exemple #1
0
        public ActionResult EdytujPost(int id)
        {
            var post = ObsługaBazyDanych.zwrocPostPoId(id);

            TempData["BlogPostId"] = post.Blogs.Blog_ID;
            return(View(post));
        }
Exemple #2
0
        public ActionResult blogPartialView(string blogID)
        {
            var lookupId = int.Parse(blogID);
            var model    = ObsługaBazyDanych.zwrocBlogPoId(lookupId);

            return(PartialView("blogFollowButton", model));
        }
Exemple #3
0
        public ActionResult LogIn(LogInModel model)
        {
            if (!ModelState.IsValid)
            {
                if (model.Email == null || model.Password == null)
                {
                    ModelState.AddModelError("", "Pole email i haslo nie mogą być puste!");
                    return(View());
                }
                return(View());
            }
            if (model.Email.Equals("") || model.Password.Equals(""))
            {
                ModelState.AddModelError("", "Pole email i haslo nie mogą być puste!");
                return(View());
            }

            var user = ObsługaBazyDanych.sprawdzCzyUzytkownikIsniteje(model.Email, model.Password);

            if (!(user is null))
            {
                FormsAuthentication.SetAuthCookie(user.username, false);
                return(RedirectToAction("Index", "Main"));
            }

            ModelState.AddModelError("", "Niepoprawny email lub hasło");
            return(View());
        }
Exemple #4
0
        public ActionResult commentPartialView(string commentId)
        {
            var lookupId = int.Parse(commentId);
            var model    = ObsługaBazyDanych.zwrocKomentarzPoID(lookupId);

            return(PartialView("commentsPartial", model));
        }
Exemple #5
0
        public ActionResult commentListPartialView(string postID)
        {
            Debug.WriteLine(postID);
            var post = ObsługaBazyDanych.zwrocPostPoId(Int32.Parse(postID));

            return(PartialView("commentListPartial", post));
        }
Exemple #6
0
        public ActionResult UsunKomentarz(int id, int idPostu)
        {
            ObsługaBazyDanych.usunKomentarz(id);
            var post = ObsługaBazyDanych.zwrocPostPoId(idPostu);

            return(View("WyswietlPost", post));
        }
Exemple #7
0
        public ActionResult UsunPost(int id, int idBlog)
        {
            ObsługaBazyDanych.usunPost(id);
            var blog = ObsługaBazyDanych.zwrocBlogPoId(idBlog);

            return(RedirectToAction("WyswietlBlog", new { id = idBlog }));
        }
Exemple #8
0
        public ActionResult stworztagasync(string tagName)
        {
            Debug.WriteLine(tagName);
            ObsługaBazyDanych.dodajTag(tagName);
            var tag = ObsługaBazyDanych.ZwrocTagPoNazwie(tagName);

            return(Json(new { id = tag.Tag_ID, nazwa = tag.tagName }, JsonRequestBehavior.AllowGet));
        }
Exemple #9
0
 public ActionResult UsunTag(int id)
 {
     if (ObsługaBazyDanych.sprawdzCzyUzytkownikJestAdminem(User.Identity.Name))
     {
         ObsługaBazyDanych.UsunTag(id);
     }
     return(RedirectToAction("ListaTagow"));
 }
Exemple #10
0
        public ActionResult blogUnFollow(string userName, string blogID)
        {
            Debug.WriteLine(userName + " " + blogID + "pierwszyGet");
            ObsługaBazyDanych.UsunFollowZBloga(userName, blogID);

            var blog = ObsługaBazyDanych.zwrocBlogPoId(Int32.Parse(blogID));

            return(Json(new { followCount = blog.followCount, id = blog.Blog_ID, user = userName }, JsonRequestBehavior.AllowGet));
        }
Exemple #11
0
        public ActionResult komentarzDownVote(string userName, string commentID)
        {
            Debug.WriteLine(userName + " " + commentID + "pierwszyGet");
            ObsługaBazyDanych.UsunGlosDoKomentarza(userName, commentID);
            //ObsługaBazyDanych.bazadanych.VotesSet.Add();
            var comment = ObsługaBazyDanych.zwrocKomentarzPoID(Int32.Parse(commentID));

            return(Json(new { upVotes = comment.upVotes, id = comment.Comment_ID, user = userName }, JsonRequestBehavior.AllowGet));
        }
Exemple #12
0
 public ActionResult StworzTag(Tags tag)
 {
     if (ModelState.IsValid)
     {
         ObsługaBazyDanych.dodajTag(tag);
         return(RedirectToAction("ListaTagow"));
     }
     return(View());
 }
Exemple #13
0
 public ActionResult StworzKind(Kinds kind)
 {
     if (ModelState.IsValid)
     {
         ObsługaBazyDanych.dodajKind(kind);
         return(RedirectToAction("ListaKind"));
     }
     return(View());
 }
Exemple #14
0
        public ActionResult ListaUzytkownikow()
        {
            if (ObsługaBazyDanych.sprawdzCzyUzytkownikJestAdminem(User.Identity.Name))
            {
                List <Users> listauzytkownikow = ObsługaBazyDanych.zwrocListeUzytkownikow();
                return(View(listauzytkownikow));
            }

            return(RedirectToAction("Index"));
        }
Exemple #15
0
 public ActionResult EdytujBlog(Blogs blog, FormCollection form)
 {
     if (ModelState.IsValid)
     {
         var test = form["KindsIds"];
         ObsługaBazyDanych.EdytujBlog(blog, test);
         return(RedirectToAction("ListaBlogow"));
     }
     return(RedirectToAction("ListaBlogow"));
 }
Exemple #16
0
        public ActionResult EdytujPost(Post post, FormCollection form)
        {
            var idBlogu = (int)TempData["BlogPostId"];

            if (ModelState.IsValid)
            {
                var test = form["TagsIds"];
                ObsługaBazyDanych.EdytujPost(post, test);
                return(RedirectToAction("WyswietlBLog", new { id = idBlogu }));
            }
            return(RedirectToAction("WyswietlBLog", new { id = idBlogu }));
        }
Exemple #17
0
        public ActionResult StworzKomentarzJava(int id, string content)
        {
            Debug.WriteLine(id + content);

            Comments comment = new Comments();

            comment.content = content;
            comment.User_ID = ObsługaBazyDanych.zwrocIdUzytkownikaPoUsername(User.Identity.Name);
            ObsługaBazyDanych.dodajKomentarz(id, comment);

            return(Json(new { id1 = id }, JsonRequestBehavior.AllowGet));
        }
Exemple #18
0
        public ActionResult StworzKomentarz(Comments comment)
        {
            var idPostu = (int)TempData["PostCommentId"];

            if (ModelState.IsValid)
            {
                comment.User_ID = ObsługaBazyDanych.zwrocIdUzytkownikaPoUsername(User.Identity.Name);
                ObsługaBazyDanych.dodajKomentarz(idPostu, comment);
                return(RedirectToAction("WyswietlPost", new { id = idPostu }));
            }
            return(View());
        }
Exemple #19
0
        public ActionResult Register(Users user)
        {
            if (ModelState.IsValid)
            {
                user.dataAktualizacji = DateTime.Now;
                user.dataStworzenia   = DateTime.Now;
                user.isAdmin          = false;

                ObsługaBazyDanych.dodajNowegoUzytkownika(user);

                return(RedirectToAction("Index", "Main"));
            }
            return(View());
        }
Exemple #20
0
        public ActionResult StworzBlog(Blogs blog, FormCollection form)
        {
            if (ModelState.IsValid)
            {
                //foreach (int i in kindID) Debug.WriteLine(i.ToString());
                var test = form["KindsIds"];

                blog.dataAktualizacji = DateTime.Now;
                blog.dataZalozenia    = DateTime.Now;
                blog.followCount      = 0;
                ObsługaBazyDanych.dodajNowyBlog(User.Identity.Name, blog, test);
                return(RedirectToAction("ListaBlogow"));
            }
            return(View());
        }
Exemple #21
0
        public GraInwestycyjna()
        {
            InitializeComponent();
            var service = new ObsługaBazyDanych();

            hasło_txt.PasswordChar = '*';
            hasło_txt.MaxLength    = 8;


            //   StwórzFirmy();


            //    UsunNiepotrzebne_Sprzatacz();
            //     StwórzWaluty();


            //  service.PobieranieDanychAkcje();
            //     service.PobieranieDanychWaluty(); // uwaga -> trwa około 30 minut

            //   service.DodajPrzykladowoInwestycje();
            //   service.WypiszInwestycje();

            //   MessageBox.Show("Done!");
        }
Exemple #22
0
        //na razie authorize

        public ActionResult WyswietlBlog(int id)
        {
            var blog = ObsługaBazyDanych.zwrocBlogPoId(id);

            return(View(blog));
        }
Exemple #23
0
        public ActionResult ListaBlogowUzytkownika(string username)
        {
            var listablogow = ObsługaBazyDanych.zwrocListeBlogowUzytkownika(username);

            return(View(listablogow));
        }
Exemple #24
0
        public ActionResult ListaPostowPoTagu(int id)
        {
            var listapostow = ObsługaBazyDanych.zwrocPostyDanegoTagu(id);

            return(View(listapostow));
        }
Exemple #25
0
        public ActionResult ListaBlogowPoKind(int id)
        {
            var listablogow = ObsługaBazyDanych.zwrocBlogiDanegoKind(id);

            return(View("ListaBlogow", listablogow));
        }
Exemple #26
0
        public ActionResult ListaBlogow()
        {
            var listablogow = ObsługaBazyDanych.zwrocListeBlogow();

            return(View(listablogow));
        }
Exemple #27
0
        public ActionResult PostyFollowedBlogs()
        {
            var listapostow = ObsługaBazyDanych.zwrocPostyZFollowanychBlogow(User.Identity.Name);

            return(View(listapostow));
        }
Exemple #28
0
        public ActionResult WyswietlPost(int id)
        {
            var post = ObsługaBazyDanych.zwrocPostPoId(id);

            return(View(post));
        }
Exemple #29
0
 public ActionResult ListaTagow()
 {
     return(View(ObsługaBazyDanych.zwrocListeTag()));
 }
Exemple #30
0
 public ActionResult ListaKind()
 {
     return(View(ObsługaBazyDanych.zwrocListeKind()));
 }