public ActionResult Create(Animal animal) { animal.Date = DateTime.Now; _db.Animals.Add(animal); _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(Animal animal) { _db.Animals.Add(animal); _db.SaveChanges(); Console.WriteLine("hi"); return(RedirectToAction("Index")); }
public void Post([FromBody] Animal animal) { Console.WriteLine("Post"); List <string> animals = _db.Animals.Select(w => w.Name).ToList(); if (animals.Contains(animal.Name)) { int animalId = _db.Animals.FirstOrDefault(w => w.Name == animal.Name).AnimalId; animal.AnimalId = animalId; _db.Entry(animal).State = EntityState.Modified; _db.SaveChanges(); } else { _db.Animals.Add(animal); _db.SaveChanges(); } }
public void Create([FromBody] User userParam) { Console.WriteLine("check"); if (!_db.Users.Any(a => a.Username == userParam.Username)) { Console.WriteLine("Check"); userParam.PasswordHash = SecurePasswordHasher.Hash(userParam.Password, 1000); userParam.Password = null; _db.Users.Add(userParam); _db.SaveChanges(); } }
public ActionResult Create(Animal animal) { if (ModelState.IsValid) { _db.Animals.Add(animal); _db.SaveChanges(); return(RedirectToAction("Index")); } else { return(View(animal)); } }
public ActionResult Create(AnimalsCreateViewModel t, string newbreed, string newtype) { Animal animal = new Animal { Name = t.Name, Gender = t.Gender, Breed = (String.IsNullOrEmpty(newbreed)) ? t.Breed : newbreed, Type = (String.IsNullOrEmpty(newtype)) ? t.Type : newtype }; _db.Animals.Add(animal); _db.SaveChanges(); return(RedirectToAction("Index", "Home")); }
public void Post([FromBody] Cat cat) { _db.Cats.Add(cat); _db.SaveChanges(); }
public void Post([FromBody] Shelter shelter) { _db.Shelters.Add(shelter); _db.SaveChanges(); }
public ActionResult Create(Type type) { _db.Types.Add(type); _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(Detail detail) { _db.DetailGroup.Add(detail); _db.SaveChanges(); return(RedirectToAction("Index")); }
public void Post([FromBody] AnimalsPreviouslyOwned animalsPreviouslyOwned) { _db.AnimalsPreviouslyOwned.Add(animalsPreviouslyOwned); _db.SaveChanges(); }
public ActionResult Create(Animal animal) { _db.Animal.Add(animal); _db.SaveChanges(); return(RedirectToAction("Index")); }
public void Post([FromBody] Animal animal) { _db.Animals.Add(animal); _db.SaveChanges(); }
public void Post([FromBody] Bird bird) { _db.Birds.Add(bird); _db.SaveChanges(); }
public virtual void Commit() { _context.SaveChanges(); }
public void Delete(int id) { Vaccination vaccineToDelete = _db.Vaccinations.FirstOrDefault(entry => entry.VaccinationId == id); _db.Vaccinations.Remove(vaccineToDelete); _db.SaveChanges(); }
public ActionResult Create(TypeClass typeClass) { _db.TypeClassGroup.Add(typeClass); _db.SaveChanges(); return(RedirectToAction("Index")); }
public void Post([FromBody] Animal value) { _db.Animals.Add(value); _db.SaveChanges(); }
public void Post([FromBody] ShelterList shelterList) { _db.ShelterList.Add(shelterList); _db.SaveChanges(); }
public ActionResult Post([FromBody] Animal animal) { _db.Animals.Add(animal); _db.SaveChanges(); return(Ok($"{animal.Name} was added to the database")); }
public void Post([FromBody] PreviousOwner previousOwner) { _db.PreviousOwners.Add(previousOwner); _db.SaveChanges(); }
public ActionResult Create(Species species) { _db.Species.Add(species); _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(Animal animal) { _db.Entry(animal).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index")); }
public void Post([FromBody] Animal new_animal) { _dataBase.Animals.Add(new_animal); _dataBase.SaveChanges(); }
public void Put(int id, [FromBody] Animal animal) { animal.AnimalId = id; _db.Entry(animal).State = EntityState.Modified; _db.SaveChanges(); }
public ActionResult Create(Pets pet) { _db.Pets.Add(pet); _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(Category category) { _db.Categories.Add(category); _db.SaveChanges(); return(RedirectToAction("Index")); }
[HttpPost] //POST api/dogs public void Post([FromBody] Dog dog) { _db.Dogs.Add(dog); _db.SaveChanges(); }
public void Post([FromBody] AnimalVaccination animalVaccination) { _db.AnimalVaccinations.Add(animalVaccination); _db.SaveChanges(); }