示例#1
0
        public ActionResult Create([Bind(Include = "FirstName,LastName,PhoneNumber,UserId")] ApplicationUser newUser)
        {
            if (ModelState.IsValid)
            {
                EmployeeUsers newEmployee = new EmployeeUsers()
                {
                    UserId      = User.Identity.GetUserId(),
                    FirstName   = newUser.FirstName,
                    LastName    = newUser.LastName,
                    PhoneNumber = newUser.PhoneNumber
                };

                db.EmployeeUsers.Add(newEmployee);
                db.SaveChanges();

                ApplicationUser currentUser = db.Users.FirstOrDefault(c => c.Id == newEmployee.UserId);

                var ViewModel = new EmployeeUsersCreateViewModel
                {
                    Employee = newEmployee,
                    AppUser  = currentUser
                };
                return(View("Create", ViewModel));
            }

            return(View(newUser));
        }
示例#2
0
        public ActionResult DeleteConfirmed(int id)
        {
            EmployeeUsers employeeUsers = db.EmployeeUsers.Find(id);

            db.EmployeeUsers.Remove(employeeUsers);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#3
0
        // GET: EmployeeUsers
        public ActionResult Index()
        {
            var            currentUserId     = User.Identity.GetUserId();
            EmployeeUsers  employee          = db.EmployeeUsers.Where(c => c.UserId == currentUserId).First();
            var            employeeZip       = db.Users.Where(c => c.Id == employee.UserId).First().Zipcode;
            List <PickUps> PickUpsByZipToday = db.PickUps.Where(c => c.Zipcode == employeeZip && DbFunctions.TruncateTime(c.PickUpDate) == DateTime.Today.Date).ToList();

            return(View(PickUpsByZipToday));
        }
示例#4
0
 public ActionResult Edit([Bind(Include = "EmployeeId,UserId,Address")] EmployeeUsers employeeUsers)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employeeUsers).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(employeeUsers));
 }
示例#5
0
        // GET: EmployeeUsers/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EmployeeUsers employeeUsers = db.EmployeeUsers.Find(id);

            if (employeeUsers == null)
            {
                return(HttpNotFound());
            }
            return(View(employeeUsers));
        }
示例#6
0
        public ActionResult LoginAdmin(string userinputLogin, string passwordinputLogin)
        {
            EmployeeUsers employeeUser = new EmployeeUsers();


            employeeUser = loginService.LoginEmployee(userinputLogin, passwordinputLogin);

            if (employeeUser.SuccessfulOperation == true)
            {
                System.Web.Security.FormsAuthentication.RedirectFromLoginPage(employeeUser.Id.ToString(), false);
            }

            return(View("Index"));
        }