예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            DeliveryStaff deliverystaff = db.DeliveryStaffs.Find(id);

            db.DeliveryStaffs.Remove(deliverystaff);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
        //
        // GET: /Admin/DeliveryStaff/Delete/5

        public ActionResult Delete(int id = 0)
        {
            DeliveryStaff deliverystaff = db.DeliveryStaffs.Find(id);

            if (deliverystaff == null)
            {
                return(HttpNotFound());
            }
            return(View(deliverystaff));
        }
예제 #3
0
 public ActionResult Edit(DeliveryStaff deliverystaff)
 {
     if (ModelState.IsValid)
     {
         db.Entry(deliverystaff).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(deliverystaff));
 }
예제 #4
0
        public ActionResult Create(DeliveryStaff deliverystaff)
        {
            if (ModelState.IsValid)
            {
                db.DeliveryStaffs.Add(deliverystaff);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(deliverystaff));
        }
예제 #5
0
 public void AddorUpdateDeliveryStaff(DeliveryStaff deliveryStaff)
 {
     try
     {
         if (deliveryStaff.DeliveryStaffId == 0)
         {
             _context.DeliveryStaff.Add(deliveryStaff);
             _context.SaveChanges();
         }
         else
         {
             _context.DeliveryStaff.Update(deliveryStaff);
             _context.SaveChanges();
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
예제 #6
0
        private static StaffGroup GetStaffMembers()
        {
            var bob = new Person {
                Name = "Bob"
            };
            var dave = new Person {
                Name = "Dave"
            };
            var suzie = new Person {
                Name = "Suzie"
            };
            var mary = new Person {
                Name = "Mary"
            };
            var debbie = new Person {
                Name = "Debbie"
            };
            var brian = new Person {
                Name = "Brian"
            };
            var rafa = new Person {
                Name = "Rafa"
            };
            var roger = new Person {
                Name = "Roger"
            };
            var novak = new Person {
                Name = "Novak"
            };
            var andy = new Person {
                Name = "Andy"
            };
            var steffi = new DeliveryStaff {
                Person = new Person {
                    Name = "Steffi"
                }
            };
            var andre = new DeliveryStaff {
                Person = new Person {
                    Name = "Andre"
                }
            };
            var pete = new DeliveryStaff {
                Person = new Person {
                    Name = "Pete"
                }
            };

            var dishWashers = new StaffGroup {
                Name = "Dishwashers", Members = { roger, novak, andy }
            };
            var kitchenStaff = new StaffGroup {
                Name = "Kitchen Staff", Members = { bob, dave, suzie, dishWashers }
            };
            var supportStaff = new StaffGroup {
                Name = "Support Staff", Members = { mary, debbie, brian, rafa }
            };

            var staffMembers = new StaffGroup {
                Members = { kitchenStaff, supportStaff, steffi, andre, pete }
            };

            return(staffMembers);
        }