public List <Vaccine> GetList() { using (this.context = new PetControlEntities()) { return(this.context.Vaccines.ToList()); } }
public bool Update(ref Record newRecord) { try { var id = newRecord.id; using (this.context = new PetControlEntities()) { var oldRecord = this.context.Records.SingleOrDefault(b => b.id == id); if (oldRecord != null) { oldRecord.isVaccine = newRecord.isVaccine; oldRecord.notes = newRecord.notes; oldRecord.recordNumber = newRecord.recordNumber; oldRecord.status = newRecord.status; oldRecord.tags = newRecord.tags; oldRecord.type = newRecord.type; this.context.SaveChanges(); } } return(true); } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public List <Record> GetList() { using (this.context = new PetControlEntities()) { return(this.context.Records.ToList()); } }
public bool Update(ref Vaccine newVaccine) { try { var id = newVaccine.id; using (this.context = new PetControlEntities()) { var oldVaccine = this.context.Vaccines.SingleOrDefault(b => b.id == id); if (oldVaccine != null) { oldVaccine.cost = newVaccine.cost; oldVaccine.description = newVaccine.description; oldVaccine.disease = newVaccine.disease; oldVaccine.living = newVaccine.living; oldVaccine.name = newVaccine.name; oldVaccine.preparation = newVaccine.preparation; oldVaccine.type = newVaccine.type; this.context.SaveChanges(); } } return(true); } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public bool Update(ref User newUser) { try { var id = newUser.id; using (this.context = new PetControlEntities()) { var oldUser = this.context.Users.SingleOrDefault(b => b.id == id); if (oldUser != null) { oldUser.address = newUser.address; oldUser.description = newUser.description; oldUser.email = newUser.email; oldUser.firstName = newUser.firstName; oldUser.lastName = newUser.lastName; oldUser.nickName = newUser.nickName; this.context.SaveChanges(); } } return(true); } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public bool Update(ref Pet newPet) { try { var id = newPet.id; using (this.context = new PetControlEntities()) { var oldPet = this.context.Pets.SingleOrDefault(b => b.id == id); if (oldPet != null) { oldPet.name = newPet.name; oldPet.specie = newPet.specie; oldPet.birthDate = newPet.birthDate; oldPet.breed = newPet.breed; oldPet.description = newPet.description; this.context.SaveChanges(); } } return(true); } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public List <Pet> GetList() { using (this.context = new PetControlEntities()) { return(this.context.Pets.ToList()); } }
public User Get(string id) { try { User user; using (this.context = new PetControlEntities()) { user = this.context.Users.SingleOrDefault(u => u.id == new Guid(id)); } return(user); } catch (Exception ex) { Console.WriteLine(ex.Message); return(null); } }
public Record Get(string id) { try { Record record; using (this.context = new PetControlEntities()) { record = this.context.Records.SingleOrDefault(u => u.id == new Guid(id)); } return(record); } catch (Exception ex) { Console.WriteLine(ex.Message); return(null); } }
public Vaccine Get(string id) { try { Vaccine vaccine; using (this.context = new PetControlEntities()) { vaccine = this.context.Vaccines.SingleOrDefault(u => u.id == new Guid(id)); } return(vaccine); } catch (Exception ex) { Console.WriteLine(ex.Message); return(null); } }
public Pet Get(string id) { try { Pet pet; using (this.context = new PetControlEntities()) { pet = this.context.Pets.SingleOrDefault(u => u.id == new Guid(id)); } return(pet); } catch (Exception ex) { Console.WriteLine(ex.Message); return(null); } }
public bool Post(Record record) { try { record.id = Guid.NewGuid(); using (this.context = new PetControlEntities()) { this.context.Records.Add(record); this.context.SaveChanges(); } return(true); } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public bool Post(Vaccine vaccine) { try { vaccine.id = Guid.NewGuid(); using (this.context = new PetControlEntities()) { this.context.Vaccines.Add(vaccine); this.context.SaveChanges(); } return(true); } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public bool Delete(string id) { try { using (this.context = new PetControlEntities()) { Record record = new Record { id = new Guid(id) }; this.context.Records.Attach(record); this.context.Records.Remove(record); this.context.SaveChanges(); } return(true); } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public bool Delete(string id) { try { using (this.context = new PetControlEntities()) { var vaccine = new Vaccine { id = new Guid(id) }; this.context.Vaccines.Attach(vaccine); this.context.Vaccines.Remove(vaccine); this.context.SaveChanges(); } return(true); } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public RecordDAL(PetControlEntities context) { this.context = context; }
public VaccineDAL(PetControlEntities context) { this.context = context; }
public PetDAL(PetControlEntities context) { this.context = context; }