public IActionResult DeleteTrainer(AdminDTO data) { var trainer = db.Trainers.FirstOrDefault(x => x.TUsername == data.Username); if (trainer != null) { db.Trainers.Remove(trainer); db.SaveChanges(); } return(Ok()); }
public IActionResult AdminLogin(AdminDTO data) { var admin = db.Admin.FirstOrDefault(x => x.Email == data.Email); if (!db.Admin.Any(x => data.Email == x.Email) || !db.Admin.Any(x => data.Password == x.Password)) { return(NotFound()); } var jwt = jwtService.Generate(admin.Id); Response.Cookies.Append("jwt", jwt, cookieOptions); return(Ok(new { message = "success", Username = admin.Username })); }