public async Task <ActionResult> DeleteConfirmed(int id)
        {
            LigneDeVente ligneDeVente = await db.LigneDeVentes.FindAsync(id);

            db.LigneDeVentes.Remove(ligneDeVente);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            LigneDeVente ligneDeVente = await db.LigneDeVentes.FindAsync(id);

            var idFcl = (from ppl in db.LigneDeVentes where ppl.ACHVNT_ID == id select ppl.FCL_ID).FirstOrDefault();

            db.LigneDeVentes.Remove(ligneDeVente);
            await db.SaveChangesAsync();

            return(RedirectToAction("Details", new { Controller = "DossierFclExports", id = idFcl }));
        }
        public async Task <ActionResult> Edit([Bind(Include = "ACHVNT_ID,FCL_ID,DEVIS_ID,ACHVNT_DESC_ACHAT,ACHVNT_DESC_VENTE,ACHVNT_NAT_ACHAT,ACHVNT_PRIX_ACHAT,ACHVNT_PRIX_VENTE,ACHVNT_OBS")] LigneDeVente ligneDeVente)
        {
            if (ModelState.IsValid)
            {
                db.Entry(ligneDeVente).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.DEVIS_ID = new SelectList(db.Devis, "DEVIS_ID", "DEVIS_REF_FORM", ligneDeVente.DEVIS_ID);
            ViewBag.FCL_ID   = new SelectList(db.DossierFclExports, "FCL_ID", "FCL_ID", ligneDeVente.FCL_ID);
            return(View(ligneDeVente));
        }
        // GET: LigneDeVentes/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LigneDeVente ligneDeVente = await db.LigneDeVentes.FindAsync(id);

            if (ligneDeVente == null)
            {
                return(HttpNotFound());
            }
            return(View(ligneDeVente));
        }
Пример #5
0
        public async Task <ActionResult> Create([Bind(Include = "ACHVNT_ID,FCL_ID,DEVIS_ID,ACHVNT_DESC_ACHAT,ACHVNT_DESC_VENTE,ACHVNT_NAT_ACHAT,ACHVNT_PRIX_ACHAT,ACHVNT_PRIX_VENTE,ACHVNT_OBS")] LigneDeVente ligneDeVente)
        {
            if (ModelState.IsValid)
            {
                db.LigneDeVentes.Add(ligneDeVente);
                await db.SaveChangesAsync();

                return(RedirectToAction("Details", new { Controller = "DossierFclExports", id = ligneDeVente.FCL_ID }));
            }

            ViewBag.DEVIS_ID = new SelectList(db.Devis, "DEVIS_ID", "DEVIS_ID", ligneDeVente.DEVIS_ID);
            ViewBag.FCL_ID   = new SelectList(db.DossierFclExports, "FCL_ID", "FCL_ID", ligneDeVente.FCL_ID);
            return(View(ligneDeVente));
        }
        // GET: LigneDeVentes/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LigneDeVente ligneDeVente = await db.LigneDeVentes.FindAsync(id);

            if (ligneDeVente == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DEVIS_ID = new SelectList(db.Devis, "DEVIS_ID", "DEVIS_REF_FORM", ligneDeVente.DEVIS_ID);
            ViewBag.FCL_ID   = new SelectList(db.DossierFclExports, "FCL_ID", "FCL_ID", ligneDeVente.FCL_ID);
            return(View(ligneDeVente));
        }
        public async Task <ActionResult> Create([Bind(Include = "ACHVNT_ID,FCL_ID,DEVIS_ID,ACHVNT_DESC_ACHAT,ACHVNT_DESC_VENTE,ACHVNT_NAT_ACHAT,ACHVNT_PRIX_ACHAT,ACHVNT_PRIX_VENTE,ACHVNT_OBS")] LigneDeVente ligneDeVente)
        {
            try {
                if (ModelState.IsValid)
                {
                    db.LigneDeVentes.Add(ligneDeVente);
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Details", new { Controller = "DossierFclExports", id = ligneDeVente.FCL_ID }));
                }
            }
            catch (RetryLimitExceededException /* dex */)
            {
                ModelState.AddModelError(" ", "Unable to save changes. Try again, and if the problem persists see your system administrator");
            }
            ViewBag.DEVIS_ID = new SelectList(db.Devis, "DEVIS_ID", "DEVIS_ID", ligneDeVente.DEVIS_ID);
            ViewBag.FCL_ID   = new SelectList(db.DossierFclExports, "FCL_ID", "FCL_ID", ligneDeVente.FCL_ID);
            return(View(ligneDeVente));
        }
        // GET: LigneDeVentes/Edit/5
        public async Task <ActionResult> Edit(int?id, string idFcl)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LigneDeVente ligneDeVente = await db.LigneDeVentes.FindAsync(id);

            if (ligneDeVente == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DEVIS_ID = new SelectList(db.Devis, "DEVIS_ID", "DEVIS_ID", ligneDeVente.DEVIS_ID);
            if (!String.IsNullOrEmpty(idFcl))
            {
                ViewBag.FCL_ID = new SelectList(db.DossierFclExports, "FCL_ID", "FCL_ID", idFcl);
            }
            else
            {
                ViewBag.FCL_ID = new SelectList(db.DossierFclExports, "FCL_ID", "FCL_ID");
            }
            return(View(ligneDeVente));
        }