public async Task <ActionResult> DeleteConfirmed(string id)
        {
            CompagnieMaritime compagnieMaritime = await db.CompagnieMaritimes.FindAsync(id);

            db.CompagnieMaritimes.Remove(compagnieMaritime);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Пример #2
0
        public async Task <ActionResult> Edit([Bind(Include = "CM_REF,CM_NOMRAIS,CM_SIRET,CM_ADRESSE,CM_CP,CM_VILLE,CM_PAYS,CM_MAIL,CM_TEL,CM_TELPORT,CM_FAX,CM_OBS")] CompagnieMaritime compagnieMaritime)
        {
            if (ModelState.IsValid)
            {
                db.Entry(compagnieMaritime).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(compagnieMaritime));
        }
        // GET: CompagnieMaritimes/Edit/5
        public async Task <ActionResult> Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CompagnieMaritime compagnieMaritime = await db.CompagnieMaritimes.FindAsync(id);

            if (compagnieMaritime == null)
            {
                return(HttpNotFound());
            }
            return(View(compagnieMaritime));
        }
        public async Task <ActionResult> Edit([Bind(Include = "CM_REF,CM_NOMRAIS,CM_SIRET,CM_ADRESSE,CM_CP,CM_VILLE,CM_PAYS,CM_MAIL,CM_TEL,CM_TELPORT,CM_FAX,CM_OBS")] CompagnieMaritime compagnieMaritime)
        {
            try {
                if (ModelState.IsValid)
                {
                    db.Entry(compagnieMaritime).State = EntityState.Modified;
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }
            }
            catch (RetryLimitExceededException /* dex */)
            {
                ModelState.AddModelError(" ", "Unable to save changes. Try again, and if the problem persists see your system administrator");
            }
            return(View(compagnieMaritime));
        }
 /// <summary>
 /// methode permettant d'ajouter une compagnie maritime à la BDD
 /// </summary>
 /// <param name="rezCompa"></param>
 public void AddCM(CompagnieMaritime rezCompa)
 {
     db.CompagnieMaritimes.Add(rezCompa);
     db.SaveChanges();
 }
 /// <summary>
 /// méthode d'ajout à la BDD d'une new compagnie maritime
 /// </summary>
 /// <param name="rezCompa"></param>
 public void AddCM(CompagnieMaritime rezCompa)
 {
     cmDao.AddCM(rezCompa);
 }