Exemple #1
0
        public async Task <ActionResult> Create(RSUser user, string newpassword, string confirmpassword)
        {
            if (ModelState.IsValid)
            {
                db.Users.Add(user);

                if (newpassword == confirmpassword)
                {
                    user.DependencyInjection();
                    user.CreatePassword(newpassword);
                }
                else
                {
                    ViewBag.ShowMessage  = true;
                    ViewBag.MessageColor = "red";
                    ViewBag.Message      = Resources.Resources.PasswordsDontMatch;
                    return(View(user));
                }
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(user));
        }
Exemple #2
0
        public async Task <ActionResult> Edit(RSUser user, string newpassword, string confirmpassword)
        {
            if (ModelState.IsValid)
            {
                db.Entry(user).State = EntityState.Modified;
                if (!string.IsNullOrWhiteSpace(newpassword) & newpassword == confirmpassword)
                {
                    user.DependencyInjection();
                    user.CreatePassword(newpassword);
                }

                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(user));
        }
Exemple #3
0
        protected override void Seed(RSDbContext context)
        {
            try
            {
                if (!context.Users.Any())
                {
                    RSUser user0 = new RSUser()
                    {
                        Id       = 0,
                        Name     = "Admin",
                        Username = "******",
                        IsAdmin  = true,
                        IsWaiter = true
                    };
                    user0.DependencyInjection();
                    user0.CreatePassword("admin");
                    context.Users.AddOrUpdate(user0);
                }


                if (!context.Styles.Any(s => s.Type == (int)RSStyleType.MenuStyle))
                {
                    context.Styles.Add(new Models.RSStyle()
                    {
                        Path     = "/Content/Menu/default.css",
                        Selected = true,
                        Title    = "Default Menu Style",
                        Type     = (int)RSStyleType.MenuStyle,
                        Notes    = "This theme was provided by with the product to showcase menu printing capabilities of the product.",
                    });

                    context.Styles.Add(new Models.RSStyle()
                    {
                        Path     = "/Content/Receipt/default.css",
                        Selected = true,
                        Title    = "Default Receipt Style",
                        Type     = (int)RSStyleType.MenuStyle,
                        Notes    = "This theme was provided by with the product to showcase receipt printing capabilities of the product.",
                    });
                }
            }
            catch (Exception ex)
            {
            }
        }