コード例 #1
0
        public async Task <IActionResult> AddExp(string id, [FromBody] Experience_prof exp)
        {
            var user = await GetCandidat(id);

            if (user != null)
            {
                exp.candidat = user;
                _context.Add(exp);
                _context.SaveChanges();
                return(Ok(new
                {
                    exp = exp
                }));
            }
            return(NotFound());
        }
コード例 #2
0
        public async Task <IActionResult> UpdateExp(int id, Experience_prof exp)
        {
            var experience = await _context.Experience_prof.FindAsync(id);

            if (experience != null)
            {
                experience.candidat              = experience.candidat;
                experience.employeur             = exp.employeur;
                experience.poste_occupe          = exp.poste_occupe;
                experience.lieu_Exp              = exp.lieu_Exp;
                experience.typeEmploi            = exp.typeEmploi;
                experience.date_debut            = exp.date_debut;
                experience.date_fin              = exp.date_fin;
                experience.description           = exp.description;
                _context.Entry(experience).State = EntityState.Modified;
                _context.SaveChanges();
                return(Ok(new
                {
                    updatedexp = experience
                }));
            }
            return(NotFound());
        }