示例#1
0
        public async Task <IActionResult> Post([FromBody] Jury jury)
        {
            _context.Jurys.Add(jury);
            await _context.SaveChangesAsync();

            return(Ok());
        }
示例#2
0
        public async Task <IActionResult> Post([FromBody] Student student)
        {
            _context.Students.Add(student);
            await _context.SaveChangesAsync();

            return(Ok());
        }
示例#3
0
        public async Task <IActionResult> Post([FromBody] Critere critere1)
        {
            _context.Criteres.Add(critere1);
            await _context.SaveChangesAsync();

            return(Ok());
        }
示例#4
0
        public async Task <IActionResult> Put(int id, [FromBody] Evaluation evaluation)
        {
            var dbEval = _context.Evaluations.FirstOrDefault(x => x.Id == id);

            dbEval.Date       = evaluation.Date;
            dbEval.EtudiantId = evaluation.EtudiantId;
            dbEval.C1         = evaluation.C1;
            dbEval.C2         = evaluation.C2;
            dbEval.C3         = evaluation.C3;
            dbEval.C4         = evaluation.C4;
            dbEval.NotePhase1 = evaluation.NotePhase1;
            dbEval.C5         = evaluation.C5;
            dbEval.C6         = evaluation.C6;
            dbEval.C7         = evaluation.C7;
            dbEval.C8         = evaluation.C8;
            dbEval.C9         = evaluation.C9;
            dbEval.NotePhase2 = evaluation.NotePhase2;
            dbEval.P1         = evaluation.P1;
            dbEval.P2         = evaluation.P2;
            dbEval.Resultat   = evaluation.Resultat;

            _context.Evaluations.Update(dbEval);
            await _context.SaveChangesAsync();

            return(Ok());
        }
示例#5
0
        public async Task <User> Register(User user, string password)
        {
            byte[] passwordHash, passwordSalt;
            CreatePasswordHash(password, out passwordHash, out passwordSalt);

            // user.PasswordHash = passwordHash;
            // user.PasswordSalt = passwordSalt;

            await _context.Users.AddAsync(user);

            await _context.SaveChangesAsync();

            return(user);
        }
示例#6
0
 public async Task <bool> SaveAll()
 {
     return(await _context.SaveChangesAsync() > 0);
 }