Exemplo n.º 1
0
        public ActionResult Create([Bind(Include = "UserId,UserName,UserPhone,UserPassword")] User user)
        {
            if (ModelState.IsValid)
            {
                db.Users.Add(user);
                db.SaveChanges();
                var x = user.UserId;
                Response.Write("<script>alert('Registration Successfull! Your Login id is : " + x + "')</script>");
                //return RedirectToAction("Login","UserLogin");
            }

            return(View(user));
        }
Exemplo n.º 2
0
 public ActionResult Create([Bind(Include = "InvoiceId,InvoiceDate,InvoiceTotal,SalesmanId")] Record record)
 {
     if (Session["SALESMAN"] == null || Session["SALESMAN"].ToString() != "salesman")
     {
         return(RedirectToAction("Login", "SalesmenLogin"));
     }
     else
     {
         if (ModelState.IsValid)
         {
             db.Records.Add(record);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         ViewBag.SalesmanId = new SelectList(db.Salesmans, "SalesmanId", "SalesmanName", record.SalesmanId);
         return(View(record));
     }
 }
        public ActionResult Create([Bind(Include = "CategoryId,CategoryName")] Category category)
        {
            if (Session["ADMIN"] == null || Session["ADMIN"].ToString() != "admin")
            {
                return(RedirectToAction("Login", "AdminLogin"));
            }
            else
            {
                if (ModelState.IsValid)
                {
                    db.Categories.Add(category);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }

                return(View(category));
            }
        }
Exemplo n.º 4
0
        public ActionResult Create([Bind(Include = "ProductId,ProductName,ProductPrice,ProductQuantity,CategoryId")] Product product)
        {
            if (Session["ADMIN"] == null || Session["ADMIN"].ToString() != "admin")
            {
                return(RedirectToAction("Login", "AdminLogin"));
            }
            else
            {
                if (ModelState.IsValid)
                {
                    db.Products.Add(product);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }

                ViewBag.CategoryId = new SelectList(db.Categories, "CategoryId", "CategoryName", product.CategoryId);
                return(View(product));
            }
        }
Exemplo n.º 5
0
        public ActionResult Create([Bind(Include = "SalesmanId,SalesmanName,SalesmanEmail,SalesmanPhone,SalesmanAddress,SalesmanDOB,SalesmanJoiningDate,SalesmanSalary,SalesmanPassword")] Salesman salesman)
        {
            if (Session["ADMIN"] == null || Session["ADMIN"].ToString() != "admin")
            {
                return(RedirectToAction("Login", "AdminLogin"));
            }
            else
            {
                if (ModelState.IsValid)
                {
                    db.Salesmans.Add(salesman);
                    db.SaveChanges();
                    var x = salesman.SalesmanId;
                    Response.Write("<script>alert('Login id is : " + x + "')</script>");
                    //return RedirectToAction("Index");
                }

                return(View(salesman));
            }
        }
Exemplo n.º 6
0
        public ActionResult Create([Bind(Include = "AdminId,AdminName,AdminEmail,AdminPhone,AdminAddress,AdminDOB,AdminPassword")] Admin admin)
        {
            if (Session["ADMIN"] == null || Session["ADMIN"].ToString() != "admin")
            {
                return(RedirectToAction("Login", "AdminLogin"));
            }
            else
            {
                if (ModelState.IsValid)
                {
                    db.Admins.Add(admin);
                    db.SaveChanges();
                    var x = admin.AdminId;
                    Response.Write("<script>alert('Login id is : " + x + "')</script>");
                    //return RedirectToAction("Index");
                }

                return(View(admin));
            }
        }