public ActionResult Add(Event e, HttpPostedFileBase image)
        {
            if (image != null)
            {
                var location = Server.MapPath("~/uploading");
                var filename = location + image.FileName;
                image.SaveAs(filename);
                ViewBag.file = image.FileName;
                e.Image      = filename;

                e.Winner = null;

                db.Events.Add(e);

                db.SaveChanges();
                return(RedirectToAction("Index", "Home"));
            }

            else
            {
                //e.Winner = null;
                //db.Events.Add(e);

                //db.SaveChanges();
                return(View());
            }
        }
Exemplo n.º 2
0
        public ActionResult Index(string email)
        {
            var sub = new Subcriber();

            if (sub.Email == email)
            {
                ViewBag.error = "this email already exist";
            }
            else
            {
                sub.Email = email;
                db.Subcribers.Add(sub);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View());
        }
        public ActionResult Register(string name, int age, string qualification, string address, string phone, string email, string pwd)
        {
            var db = new NatinaolLevelPaperEntities();


            var user = new User();

            user.Name          = name;
            user.Age           = age;
            user.Qualification = qualification;
            user.Address       = address;
            user.Phone         = phone;
            user.Email         = email;

            user.Password = pwd;

            user.UserTypeId = 4;

            db.Users.Add(user);

            db.SaveChanges();

            return(RedirectToAction("login"));
        }