private IQueryable <Animal> SearchForAnimal(int iD) { HumanSocietyDataContext context = new HumanSocietyDataContext(); var animals = (from animal in context.Animals where animal.AnimalId == iD select animal); return(animals); }
internal static int GetDietPlanId(int DietPlanId) { var db = new HumanSocietyDataContext(); var animalResult = db.DietPlans.Where(a => a.DietPlanId == DietPlanId).FirstOrDefault(); return DietPlanId; }
} //fixed internal static Room GetRoom(int animalId) { var db = new HumanSocietyDataContext(); var RoomResult = db.Rooms.Where(a => a.AnimalId == animalId).FirstOrDefault(); return RoomResult; }
internal static void RemoveAnimal(Animal animal) { HumanSocietyDataContext MyTable = new HumanSocietyDataContext(); var animalToDelete = MyTable.Animals.Where(a => a.AnimalId == AnimalId); MyTable.Animals.DeleteOnSubmit(animal); }
public static void AddNewShot(string name) { var db = new HumanSocietyDataContext(); var shot = new Shot(); shot.Name = name; db.Shots.InsertOnSubmit(shot); db.SubmitChanges(); }
internal static void UpdateAdoption(bool isAdopted, Adoption adoption) { // Adoption.ApprovalStatus == "denied"; ? var db = new HumanSocietyDataContext(); Adoption adoptionResult = db.Adoptions.Where(c => c.AdoptionFee == adoption.AnimalId).First(); db.SubmitChanges(); }
internal static void UpdateAnimal(int animalId, Dictionary<int, string> updates) { var db = new HumanSocietyDataContext(); var newInfo = db.Animals.Where(n => n.AnimalId == animalId); foreach (var n in newInfo) { db.SubmitChanges(); } }
internal static void RemoveAdoption(int animalId, int clientId) { var db = new HumanSocietyDataContext(); // foreach (animalId in Animal) { } }
internal static Adoption Adopt(Animal animal, Client client) { var adoption = new Adoption(); var animal = new Animal(); var client = new Client(); Animal GetAnimalByIdPtr = new GetAnimalByIdPtr(GetAnimalById(); object inkvoke(); var db = new HumanSocietyDataContext(); db.Adoptions.InsertOnSubmit(adoption); db.SubmitChanges(); set { Adoption.ApprovalStatus == "Adopted" }; }
/* //TODO: Shots Stuff internal static IQueryable<AnimalShot> GetShots(Animal animal) { var db = new HumanSocietyDataContext(); results = db.Animals.Where(c => c.AnimalId == Animal.AnimalId).ToList(); return results; } */ internal static void UpdateShot(string shotName, Animal animal) { var db = new HumanSocietyDataContext(); var shot = new Shot(); }
internal static IQueryable<Adoption> GetDeniedAdoptions() { var db = new HumanSocietyDataContext(); return db.Adoptions.Where(c => c.ApprovalStatus == "denied"); }
// TODO: Misc Animal Things internal static Category GetCategoryId(int CategoryId) { var db = new HumanSocietyDataContext(); var CategoryResult = db.Categories.Where(a => a.CategoryId == CategoryId).FirstOrDefault(); return CategoryResult; } //fixed
internal static Animal GetAnimalByID(int id) { var db = new HumanSocietyDataContext(); var animalResult = db.Animals.Where(a => a.AnimalId == id).FirstOrDefault(); return animalResult; }
// TODO: Animal CRUD Operations internal static void AddAnimal(Animal animal) { HumanSocietyDataContext MyTable = new HumanSocietyDataContext(); MyTable.Animals.InsertOnSubmit(animal); MyTable.SubmitChanges(); }
static Query() { db = new HumanSocietyDataContext(); }