public ActionResult CreateSalon([Bind(Include = "SalonId,Name,Owner,Address,PhoneNumber,Email,WebPage,TIN,BankAccountNumber")] Salon salon)
 {
     if (ModelState.IsValid)
     {
         db.Salons.Add(salon);
         db.SaveChanges();
         return(RedirectToAction("GetSalons"));
     }
     return(View(salon));
 }
 public ActionResult CreateCategory([Bind(Include = "CategoryId,CategoryName,CategoryDescription")] Category category)
 {
     if (ModelState.IsValid)
     {
         db.Categories.Add(category);
         db.SaveChanges();
         return(RedirectToAction("GetCategories"));
     }
     return(View(category));
 }
Example #3
0
 public ActionResult CreateRole([Bind(Include = "RoleId, RoleName")] Role role)
 {
     if (ModelState.IsValid)
     {
         db.Roles.Add(role);
         db.SaveChanges();
         return(RedirectToAction("GetRoles"));
     }
     return(View(role));
 }
        public ActionResult CreateUser([Bind(Include = "UserId,UserName,Password,Name,LastName,RoleId,Address,Email")] User user)
        {
            if (ModelState.IsValid)
            {
                db.Users.Add(user);
                db.SaveChanges();
                return(RedirectToAction("GetUsers"));
            }

            ViewBag.RoleId = new SelectList(db.Roles, "RoleId", "RoleName", user.RoleId);
            return(View(user));
        }
Example #5
0
        public ActionResult CreateArticle([Bind(Include = "ArticleId,Code,ArticleName,ProductionCountry,ProductionYear,Price,StockQuantity,SalonId,CategoryId,Image")] Article article)
        {
            if (ModelState.IsValid)
            {
                //article.Image = new byte[article.Image.Length];


                db.Articles.Add(article);
                db.SaveChanges();
                return(RedirectToAction("GetArticles"));
            }

            ViewBag.SalonId    = new SelectList(db.Salons, "SalonId", "Name", article.SalonId);
            ViewBag.CategoryId = new SelectList(db.Categories, "CategoryId", "CategoryName", article.CategoryId);
            return(View(article));
        }
        public ActionResult RegisterUser([Bind(Include = "UserId,UserName,Password,Name,LastName,RoleId,Address,Email")] User user)
        {
            if (ModelState.IsValid)
            {
                db.Users.Add(user);
                db.SaveChanges();
                if (user.RoleId == 2)
                {
                    Session["RoleSS"]     = "admin";
                    Session["UserNameSS"] = user.UserName;
                    return(RedirectToAction("Index"));
                }
                else
                {
                    Session["RoleSS"]     = "kupac";
                    Session["UserNameSS"] = user.UserName;
                    return(RedirectToAction("Index"));
                }
            }

            ViewBag.RoleId = new SelectList(db.Roles, "RoleId", "RoleName", user.RoleId);
            return(View(user));
        }