Example #1
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 InsertRestaurante([FromBody] Restaurante restaurante)
        {
            try
            {
                Restaurante rest = new Restaurante();
                rest.Nome = restaurante.Nome;
                repo.Save(rest);
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.InnerException.Message));
            }

            return(Ok("Ok"));
        }