Esempio n. 1
0
        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());
        }
Esempio n. 2
0
        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());
        }
Esempio n. 3
0
        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());
        }