Esempio n. 1
0
        public int Delete(int id)
        {
            try
            {
                int resp = _rest.Delete(id);

                return(resp);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Esempio n. 2
0
        public void InsertTest()
        {
            var restaurantes = repo.GetAll();

            foreach (var item in restaurantes)
            {
                repo.Delete(item);
            }

            foreach (var item in this.GetRestaurantes())
            {
                repo.Save(item);
            }

            var countFinal = repo.GetAll().Count;

            Assert.AreEqual(this.GetRestaurantes().Count, countFinal);
        }
 public IActionResult DeleteRestaurante([FromBody] int id)
 {
     try
     {
         var rest = repo.GetById(id);
         if (rest == null)
         {
             return(NotFound());
         }
         foreach (var item in repoP.Where(p => p.RestauranteId == id).ToList())
         {
             repoP.Delete(item);
         }
         repo.Delete(rest);
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.InnerException.Message));
     }
     return(Ok("Ok"));
 }