예제 #1
0
        public async Task <IActionResult> Edit(string id, [Bind("Id,Name,NormalizedName,ConcurrencyStamp")] AspNetRoles aspNetRoles)
        {
            if (id != aspNetRoles.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(aspNetRoles);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AspNetRolesExists(aspNetRoles.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(aspNetRoles));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("PkIxMaterielsTypes,MaterielType")] IxMaterielsTypes ixMaterielsTypes)
        {
            if (id != ixMaterielsTypes.PkIxMaterielsTypes)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ixMaterielsTypes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!IxMaterielsTypesExists(ixMaterielsTypes.PkIxMaterielsTypes))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(ixMaterielsTypes));
        }
예제 #3
0
        public async Task <IActionResult> Edit(string id, [Bind("Id,UserName,NormalizedUserName,Email,NormalizedEmail,EmailConfirmed,PasswordHash,SecurityStamp,ConcurrencyStamp,PhoneNumber,PhoneNumberConfirmed,TwoFactorEnabled,LockoutEnd,LockoutEnabled,AccessFailedCount")] AspNetUsers aspNetUsers)
        {
            if (id != aspNetUsers.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(aspNetUsers);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AspNetUsersExists(aspNetUsers.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(aspNetUsers));
        }
예제 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("Pk,UserId,RoleId")] AspNetUserRoles aspNetUserRoles)
        {
            if (id != aspNetUserRoles.Pk)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(aspNetUserRoles);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AspNetUserRolesExists(aspNetUserRoles.Pk))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.AspNetUsers, "Id", "Id", "Id", aspNetUserRoles.UserId);
            ViewData["RoleId"] = new SelectList(_context.AspNetRoles, "Id", "Id", aspNetUserRoles.RoleId);

            return(View(aspNetUserRoles));
        }
예제 #5
0
        public async Task <IActionResult> Edit(int id, [Bind("PkMateriels,FkMaterielsTypes,Identifiant,DateAchat")] Materiels materiels)
        {
            if (id != materiels.PkMateriels)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(materiels);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MaterielsExists(materiels.PkMateriels))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FkMaterielsTypes"] = new SelectList(_context.IxMaterielsTypes, "PkIxMaterielsTypes", "FkMaterielsTypesNavigation.MaterielType", materiels.FkMaterielsTypes);
            return(View(materiels));
        }
예제 #6
0
        public async Task <IActionResult> Edit(int id, [Bind("PkAntenne,Ville,CodePostal,Tel,Adresse")] IxAntenne ixAntenne)
        {
            if (id != ixAntenne.PkAntenne)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ixAntenne);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!IxAntenneExists(ixAntenne.PkAntenne))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(ixAntenne));
        }
예제 #7
0
        public async Task <IActionResult> Edit(int id, [Bind("PkInterventions,FkInterventionsTypes,FkAspNetUsers,FkIxAntenne,FkMaterielsStatuts,DateDebut,DateFin,Commentaire")] LinksInterventions linksInterventions)
        {
            if (id != linksInterventions.PkInterventions)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(linksInterventions);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LinksInterventionsExists(linksInterventions.PkInterventions))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FkAspNetUsers"]        = new SelectList(_context.AspNetUsers, "Id", "Id", linksInterventions.FkAspNetUsers);
            ViewData["FkInterventionsTypes"] = new SelectList(_context.IxInterventionsTypes, "PkIxInterventionsTypes", "InterventionType", linksInterventions.FkInterventionsTypes);
            ViewData["FkIxAntenne"]          = new SelectList(_context.IxAntenne, "PkAntenne", "PkAntenne", linksInterventions.FkIxAntenne);
            ViewData["FkMaterielsStatuts"]   = new SelectList(_context.IxMaterielsStatuts, "PkIxMaterielsStatuts", "PkIxMaterielsStatuts", linksInterventions.FkMaterielsStatuts);
            return(View(linksInterventions));
        }
예제 #8
0
        public async Task <IActionResult> Edit(int id, [Bind("Pk,FkMateriels,FkMaterielsStatuts,FkIxAntenne,FkAspNetUsers,DateDebut,DateFin,Commentaire")] LinksMaterielsIxMaterielStatuts linksMaterielsIxMaterielStatuts)
        {
            string mailsend = string.Empty;
            string sujet    = string.Empty;
            string message  = string.Empty;

            if (id != linksMaterielsIxMaterielStatuts.Pk)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    if (linksMaterielsIxMaterielStatuts.FkMaterielsStatuts == 6)
                    {
                        linksMaterielsIxMaterielStatuts.DateFin = DateTime.Now.ToString("dd MMMM yyyy");
                    }
                    else
                    {
                        linksMaterielsIxMaterielStatuts.DateFin = null;
                    }
                    _context.Update(linksMaterielsIxMaterielStatuts);
                    mailsend = _context.AspNetUsers.First(c => c.Id == linksMaterielsIxMaterielStatuts.FkAspNetUsers).UserName;
                    message  = _context.Materiels.First(c => c.PkMateriels == linksMaterielsIxMaterielStatuts.FkMateriels).Identifiant;
                    await email.SendEmailAsync(mailsend, "matériel modifié", "Bonjour, \n Votre demande concernant le " + message + " a été modifié. \n Cordialement,");

                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LinksMaterielsIxMaterielStatutsExists(linksMaterielsIxMaterielStatuts.Pk))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FkAspNetUsers"]      = new SelectList(_context.AspNetUsers, "Id", "Id", linksMaterielsIxMaterielStatuts.FkAspNetUsers);
            ViewData["FkIxAntenne"]        = new SelectList(_context.IxAntenne, "PkAntenne", "PkAntenne", linksMaterielsIxMaterielStatuts.FkIxAntenne);
            ViewData["FkMateriels"]        = new SelectList(_context.Materiels, "PkMateriels", "PkMateriels", linksMaterielsIxMaterielStatuts.FkMateriels);
            ViewData["FkMaterielsStatuts"] = new SelectList(_context.IxMaterielsStatuts, "PkIxMaterielsStatuts", "PkIxMaterielsStatuts", linksMaterielsIxMaterielStatuts.FkMaterielsStatuts);
            return(View(linksMaterielsIxMaterielStatuts));
        }