Ejemplo n.º 1
0
        public ActionResult Edit(int id, TrashCanSchedule trashCanSchedule)
        {
            var updateTrashCanScheduel = context.trashCanSchedules.Where(t => t.ID == id).FirstOrDefault();

            //u.UserTypeOptions = new SelectList(
            //new List<SelectListItem>
            //{
            //   new SelectListItem { Text = "Homeowner", Value = ((int)UserType.Homeowner).ToString()},
            //   new SelectListItem { Text = "Contractor", Value = ((int)UserType.Contractor).ToString()},
            //}, "Value", "Text");
            updateTrashCanScheduel.pickUpDays      = trashCanSchedule.pickUpDays;
            updateTrashCanScheduel.ExtraPickupDate = trashCanSchedule.ExtraPickupDate;
            updateTrashCanScheduel.ZipCode         = trashCanSchedule.ZipCode;
            updateTrashCanScheduel.StartSuspend    = trashCanSchedule.StartSuspend;
            updateTrashCanScheduel.EndSuspend      = trashCanSchedule.EndSuspend;
            context.SaveChanges();

            return(RedirectToAction("CustomerTrashCanSchedule", new { id = updateTrashCanScheduel.CustomerId }));
        }
Ejemplo n.º 2
0
        public ActionResult Create(TrashCanSchedule trashCanSchedule)
        {
            var CurrentUser = User.Identity.GetUserId();

            try
            {
                var customerFound  = context.customers.Where(e => e.ApplicationUserId == CurrentUser).SingleOrDefault();
                var pickupschedule = new TrashCanSchedule {
                    CustomerId = customerFound.CustomerId, ZipCode = customerFound.ZipCode, pickUpDays = trashCanSchedule.pickUpDays, StartSuspend = trashCanSchedule.StartSuspend, EndSuspend = trashCanSchedule.EndSuspend
                };
                context.trashCanSchedules.Add(pickupschedule);
                context.SaveChanges();


                return(RedirectToAction("CustomerTrashCanSchedule", new { id = customerFound.CustomerId }));
            }
            catch
            {
                return(View());
            }
        }
Ejemplo n.º 3
0
 public ActionResult Edit(int id, TrashCanSchedule trashCanSchedule)
 {
     //var updateEmployee = context.employees.Where(e => e.EmployeeId == employee.EmployeeId).FirstOrDefault();
     //updateEmployee.FirstName = employee.FirstName;
     //updateEmployee.LastName = employee.LastName;
     //updateEmployee.Address = employee.Address;
     //updateEmployee.ZipCode = employee.ZipCode;
     //context.SaveChanges();
     try
     {
         var updateTrashCanScheduel = context.trashCanSchedules.Where(t => t.ID == id).FirstOrDefault();
         updateTrashCanScheduel.Confirmed = trashCanSchedule.Confirmed;
         updateTrashCanScheduel.Cost      = trashCanSchedule.Cost;
         context.SaveChanges();
         return(RedirectToAction("TrashCanSchedules"));
     }
     catch
     {
         return(View());
     }
 }