private List <dynamic> getSaleLine(Sale_Pet sale)
        {
            PetDBEntities db = new PetDBEntities();

            db.Configuration.ProxyCreationEnabled = false;
            return(getSaleLineList(db.Sale_Line_Pet.Include(pp => pp.Pet).Include(PP => PP.Pet.Pet_Type).ToList()));
        }
        public List <dynamic> GetAllSales()
        {
            PetDBEntities db = new PetDBEntities();

            db.Configuration.ProxyCreationEnabled = false;
            return(getSaleList(db.Sale_Pet.ToList()));
        }
Beispiel #3
0
        public List <dynamic> getAllPetTypes()
        {
            PetDBEntities db = new PetDBEntities();

            db.Configuration.ProxyCreationEnabled = false;
            return(getPetTypeList(db.Pet_Type.ToList()));
        }
        public List <dynamic> getAllPets()
        {
            PetDBEntities db = new PetDBEntities();

            db.Configuration.ProxyCreationEnabled = false;
            return(getPetList(db.Pets.Include(pp => pp.Pet_Type).ToList()));
        }
        public List <dynamic> GetAllSalesWithPets()
        {
            PetDBEntities db = new PetDBEntities();

            db.Configuration.ProxyCreationEnabled = false;
            List <Sale_Pet> sales = db.Sale_Pet.Include(pp => pp.Sale_Line_Pet).ToList();

            return(GetAllSalesWithPets(sales));
        }
Beispiel #6
0
 public List <dynamic> CreatePetType([FromBody] Pet_Type petType)
 {
     if (petType != null)
     {
         PetDBEntities db = new PetDBEntities();
         db.Configuration.ProxyCreationEnabled = false;
         db.Pet_Type.Add(petType);
         db.SaveChanges();
         return(getAllPetTypes());
     }
     else
     {
         return(null);
     }
 }
 public List <dynamic> CreatePets([FromBody] List <Pet> pets)
 {
     if (pets != null)
     {
         PetDBEntities db = new PetDBEntities();
         db.Configuration.ProxyCreationEnabled = false;
         db.Pets.AddRange(pets);
         db.SaveChanges();
         return(getAllPets());
     }
     else
     {
         return(null);
     }
 }
Beispiel #8
0
 public List <dynamic> UpdatePetType([FromBody] Pet_Type pet_Type)
 {
     if (pet_Type != null)
     {
         PetDBEntities db = new PetDBEntities();
         db.Configuration.ProxyCreationEnabled = false;
         Pet_Type objPrev = db.Pet_Type.Where(p => p.Pet_Type_ID == pet_Type.Pet_Type_ID).FirstOrDefault();
         objPrev.Pet_Type1 = pet_Type.Pet_Type1;
         db.SaveChanges();
         return(getAllPetTypes());
     }
     else
     {
         return(null);
     }
 }
 public List <dynamic> UpdatePet([FromBody] Pet pet)
 {
     if (pet != null)
     {
         PetDBEntities db = new PetDBEntities();
         db.Configuration.ProxyCreationEnabled = false;
         Pet objPrev = db.Pets.Where(p => p.Pet_ID == pet.Pet_ID).FirstOrDefault();
         objPrev.Pet_Type_ID   = pet.Pet_Type_ID;
         objPrev.Pet_Price     = pet.Pet_Price;
         objPrev.Pet_Quantitiy = pet.Pet_Quantitiy;
         db.SaveChanges();
         return(getAllPets());
     }
     else
     {
         return(null);
     }
 }
        public List <dynamic> DeletePet([FromBody] Pet pet)
        {
            PetDBEntities db = new PetDBEntities();

            db.Configuration.ProxyCreationEnabled = false;
            Pet objPrev = db.Pets.Where(p => p.Pet_ID == pet.Pet_ID).FirstOrDefault();

            if (objPrev != null)
            {
                db.Pets.Remove(objPrev);
                db.SaveChanges();
                return(getAllPets());
            }
            else
            {
                return(null);
            }
        }