Beispiel #1
0
        public string AddOutlet(Outlet Outlet)
        {
            int count     = (db.Outlets.Where(x => x.Date == Outlet.Date)).Count();
            int bothcount = (db.Outlets.Where(x => x.Date == Outlet.Date && x.FoodType == "Both")).Count();

            if ((Outlet.FoodType).Equals("Both"))
            {
                if (bothcount >= 3)
                {
                    return("There are already 3 Outlets which distribute both Veg and Non Veg");
                }
            }
            if (count < 10)
            {
                db.Outlets.Add(Outlet);
                db.SaveChanges();
                return("Outlet Added Successfully");
            }
            else
            {
                return("Outlet Cannot be added.Only ten outlets allowed for a day");
            }
        }
Beispiel #2
0
 public bool SaveChanges()
 {
     return(_context.SaveChanges() >= 0);
 }
Beispiel #3
0
 public string VolunteerRegister(Volunteers Volunteer)
 {
     db.Volunteers.Add(Volunteer);
     db.SaveChanges();
     return("Registration Successful");
 }