/// <summary> /// updates pet based on user id and new pet object /// </summary> /// <param name="id"></param> /// <param name="Pet"></param> /// <returns></returns> public ActionResult <Pet> UpdatePet(int id, Pet Pet) { var petReceived = _context.Pets.Find(id); petReceived.PetID = Pet.PetID; petReceived.Animal = Pet.Animal; petReceived.Breed = Pet.Breed; petReceived.Mix = Pet.Mix; petReceived.Name = Pet.Name; petReceived.Age = Pet.Age; petReceived.Sex = Pet.Sex; petReceived.Size = Pet.Size; petReceived.Description = Pet.Description; petReceived.ShelterID = Pet.ShelterID; petReceived.ShelterName = Pet.ShelterName; petReceived.Photos = Pet.Photos; petReceived.Address = Pet.Address; petReceived.City = Pet.City; petReceived.Zip = Pet.Zip; petReceived.State = Pet.State; petReceived.Phone = Pet.Phone; petReceived.Email = Pet.Email; _context.Pets.Update(petReceived); _context.SaveChanges(); return(petReceived); }
/// <summary> /// updates review to database /// </summary> /// <param name="userId"></param> /// <param name="petId"></param> /// <param name="review"></param> /// <returns></returns> public ActionResult UpdateReview(int userId, int petId, Review review) { var reviewReceived = _context.Reviews.Find(petId, userId); reviewReceived.Impression = review.Impression; reviewReceived.Affectionate = review.Affectionate; reviewReceived.Friendly = review.Friendly; reviewReceived.HighEnergy = review.HighEnergy; reviewReceived.Healthy = review.Healthy; reviewReceived.Intelligent = review.Intelligent; reviewReceived.Cheery = review.Cheery; reviewReceived.Playful = review.Playful; reviewReceived.Drool = review.Drool; _context.Reviews.Update(reviewReceived); _context.SaveChanges(); return(null); }