コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Label")] TypeConge typeConge)
        {
            if (id != typeConge.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(typeConge);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TypeCongeExists(typeConge.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(typeConge));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("ID,Label")] TypeConge typeConge)
        {
            if (ModelState.IsValid)
            {
                _context.Add(typeConge);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(typeConge));
        }
コード例 #3
0
 public void AjoutConge(int idCollab, Conge c, TypeConge type)
 {
     c.Type = type;
     bdd.Collaborateurs.FirstOrDefault(collab => collab.Id == idCollab).Conges.Add(c);
     bdd.Conges.Add(c);
     if (c.Type == TypeConge.RTT)
     {
         bdd.Collaborateurs.FirstOrDefault(collab => collab.Id == idCollab).CongesRestants -= c.GetDuree();
     }
     bdd.SaveChanges();
 }