예제 #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());
        }
예제 #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());
        }
예제 #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());
        }