public Menu enviarMenu(int id) { HandleMenu handle = new HandleMenu(); handle.Obtener(); Menu _menu = handle.devolverMenu(id); handle.GuardarCambios(); return(_menu); }
public IActionResult guardarMenu([FromBody] Menu menu) { int userId = menu.userId; var handle = new HandleMenu(); handle.Obtener(); handle.Actualizar(menu); handle.GuardarCambios(); return(Ok()); }
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()); } }