Example #1
0
        // GET: TrashCollectorEmployees/Edit/5
        public ActionResult Edit(int?Id)
        {
            var loggedInUser = User.Identity.GetUserId();
            TrashCollectorEmployee trashCollectorEmployee = db.TrashCollectorEmployees.Find(Id);

            return(View(trashCollectorEmployee));
        }
Example #2
0
        // GET: TrashCollectorEmployees/Create
        public ActionResult Create()
        {
            var selectedZip = db.TrashCollectorCustomers.Select(c => c.ZipCode).ToList();
            TrashCollectorEmployee Employee = new TrashCollectorEmployee();

            Employee.ZipCodeSelected = selectedZip;
            return(View(Employee));
        }
Example #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            TrashCollectorEmployee trashCollectorEmployee = db.TrashCollectorEmployees.Find(id);

            db.TrashCollectorEmployees.Remove(trashCollectorEmployee);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #4
0
        public ActionResult Edit(TrashCollectorEmployee trashCollectorEmployee)
        {
            var loggedInUser = User.Identity.GetUserId();
            var employee     = db.TrashCollectorEmployees.Single(m => m.Id == trashCollectorEmployee.Id);

            employee.FirstName    = trashCollectorEmployee.FirstName;
            employee.LastName     = trashCollectorEmployee.LastName;
            employee.RouteZipCode = trashCollectorEmployee.RouteZipCode;
            employee.RouteDay     = trashCollectorEmployee.RouteDay;
            employee.PickupStatus = trashCollectorEmployee.PickupStatus;
            db.SaveChanges();

            return(RedirectToAction("Index"));
        }
Example #5
0
        // GET: TrashCollectorEmployees/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TrashCollectorEmployee trashCollectorEmployee = db.TrashCollectorEmployees.Find(id);

            if (trashCollectorEmployee == null)
            {
                return(HttpNotFound());
            }
            return(View(trashCollectorEmployee));
        }
Example #6
0
        public ActionResult Create(TrashCollectorEmployee trashCollectorEmployee)
        {
            trashCollectorEmployee.AspUserId = User.Identity.GetUserId();

            if (ModelState.IsValid)
            {
                var getAspUser = User.Identity.GetUserId();
                trashCollectorEmployee.AspUserId = getAspUser;
                db.TrashCollectorEmployees.Add(trashCollectorEmployee);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(trashCollectorEmployee));
            }
        }