public ActionResult DeleteVaccine(int?key) { if (key is null) { throw new ArgumentNullException(nameof(key)); } pethouseContext db = new pethouseContext(); try { Vaccines vaccine = db.Vaccines.Find(key); db.Remove(vaccine); db.SaveChanges(); } catch (Exception ex) { return(BadRequest(ex.Message)); } return(Ok()); }
public ActionResult DeleteAllVaccines(int?key) { if (key is null) { throw new ArgumentNullException(nameof(key)); } pethouseContext db = new pethouseContext(); try { Vaccines vaccineRow = db.Vaccines.Where(s => s.PetId == key).FirstOrDefault(); db.Remove(vaccineRow); db.SaveChanges(); } catch (Exception ex) { return(BadRequest(ex.Message)); } return(Ok()); }
public ActionResult DeleteGrooming(int?key) { if (key is null) { throw new ArgumentNullException(nameof(key)); } pethouseContext db = new pethouseContext(); try { Grooming grooming = db.Grooming.Find(key); db.Remove(grooming); db.SaveChanges(); } catch (Exception ex) { return(BadRequest(ex.Message)); } return(Ok()); }