Example #1
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);
     }
 }
Example #2
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);
     }
 }