示例#1
0
        public Menu enviarMenu(int id)
        {
            HandleMenu handle = new HandleMenu();

            handle.Obtener();
            Menu _menu = handle.devolverMenu(id);

            handle.GuardarCambios();
            return(_menu);
        }
示例#2
0
        public IActionResult guardarMenu([FromBody] Menu menu)
        {
            int userId = menu.userId;
            var handle = new HandleMenu();

            handle.Obtener();
            handle.Actualizar(menu);
            handle.GuardarCambios();
            return(Ok());
        }
示例#3
0
        public IActionResult New([FromBody] User user)
        {
            var        _user  = _db.Users.FirstOrDefault(u => u.Email == user.Email);
            HandleMenu handle = new HandleMenu();

            if (_user != null)
            {
                return(BadRequest());
            }
            else
            {
                user.Password = HashPassHelper.Hash(user.Password);
                user.Answ     = HashPassHelper.Hash(user.Answ);
                _db.Users.Add(user);

                _db.SaveChanges();
                var User = _db.Users.FirstOrDefault(u => u.Email == user.Email);
                handle.Obtener();
                handle.Agregar(User.Id);
                Console.WriteLine("La id es: " + User.Id);
                return(Ok());
            }
        }