Пример #1
0
        public ActionResult Viewcontest(int?id)
        {
            Addmodel       ad = new Addmodel();
            tbl_tournament t  = db.tbl_tournament.Where(x => x.t_id == id).SingleOrDefault();

            ad.t_id       = t.t_id;
            ad.t_name     = t.t_name;
            ad.t_image    = t.t_image;
            ad.t_website  = t.t_website;
            ad.t_add      = t.t_add;
            ad.t_contact  = t.t_contact;
            ad.t_dts      = t.t_dts;
            ad.t_dte      = t.t_dte;
            ad.t_cat      = t.t_cat;
            ad.t_fk       = t.t_fk;
            ad.t_prize    = t.t_prize;
            ad.t_desc     = t.t_desc;
            ad.t_location = t.t_location;
            ad.t_entryfee = t.t_entryfee;
            tbl_category cat = db.tbl_category.Where(x => x.c_id == t.t_cat).SingleOrDefault();

            ad.c_name = cat.c_name;
            tbl_user user = db.tbl_user.Where(x => x.u_id == t.t_fk).SingleOrDefault();

            ad.u_name  = user.u_name;
            ad.u_img   = user.u_img;
            ad.u_desc  = user.u_desc;
            ad.u_email = user.u_email;
            ad.t_fk    = user.u_id;
            //var list = ad.ToList();
            return(View(ad));
        }
Пример #2
0
        public ActionResult CreatePost(tbl_tournament tvm, HttpPostedFileBase imgfile)
        {
            string path = uploadimgfile(imgfile);

            if (path.Equals("-1"))
            {
                ViewBag.error = "Image could not be uploaded";
            }
            else
            {
                tbl_tournament t = new tbl_tournament();
                t.t_name     = tvm.t_name;
                t.t_image    = path;
                t.t_add      = tvm.t_add;
                t.t_website  = tvm.t_website;
                t.t_dts      = tvm.t_dts;
                t.t_dte      = tvm.t_dte;
                t.t_contact  = tvm.t_contact;
                t.t_cat      = tvm.t_cat;
                t.t_fk       = Convert.ToInt32(Session["u_id"].ToString());
                t.t_desc     = tvm.t_desc;
                t.t_entryfee = tvm.t_entryfee;
                t.t_prize    = tvm.t_prize;
                t.t_location = tvm.t_location;
                db.tbl_tournament.Add(t);
                db.SaveChanges();
                Response.Redirect("Index");
            }
            return(View());
        }
Пример #3
0
        public ActionResult DeleteT(int?id)
        {
            tbl_tournament t = db.tbl_tournament.Where(x => x.t_id == id).SingleOrDefault();

            db.tbl_tournament.Remove(t);
            db.SaveChanges();
            return(View("Index"));
        }