Exemplo n.º 1
0
        // GET: Frais/Delete/5
        public ActionResult Delete(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            frais p = a.GetById(id);

            fraiVM p1 = new fraiVM()
            {
                libelle     = p.libelle,
                DTreat      = (DateTime)p.DTreat,
                NetRemb     = p.NetRemb,
                StatusFrais = p.StatusFrais,

                uneExp_id_Exp = p.uneExp_id_Exp
            };

            if (p == null)
            {
                return(HttpNotFound());
            }
            a.Delete(p);
            a.Commit();

            return(View(p1));
        }
Exemplo n.º 2
0
        public ActionResult Delete(int id, fraiVM vv)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (id == null)
                    {
                        return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                    }
                    frais p = a.GetById(id);
                    vv = new fraiVM()
                    {
                        libelle     = p.libelle,
                        DTreat      = (DateTime)p.DTreat,
                        NetRemb     = p.NetRemb,
                        StatusFrais = p.StatusFrais,

                        uneExp_id_Exp = p.uneExp_id_Exp
                    };


                    if (p == null)
                    {
                        return(HttpNotFound());
                    }
                    Console.WriteLine("Deleted");
                    a.Delete(p);
                    a.Commit();
                    // Service.Dispose();
                    return(RedirectToAction("Index"));
                }
                // TODO: Add delete logic here
                return(View(vv));
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 3
0
        public ActionResult Create(frais vv, int abc)
        {
            var depenses = b.GetMany().ToList();

            ViewBag.listexp  = new SelectList(depenses, "id_Exp", "id_Exp");
            ViewBag.listmiss = depenses;

            fraiVM d = new fraiVM()
            {
                id_frais    = vv.id_frais,
                libelle     = vv.libelle,
                DTreat      = (DateTime)vv.DTreat,
                NetRemb     = vv.NetRemb,
                StatusFrais = vv.StatusFrais,

                uneExp_id_Exp = vv.uneExp_id_Exp
            };

            vv.uneExp_id_Exp = abc;
            a.Add(vv);
            a.Commit();
            //Service.Dispose();
            return(RedirectToAction("Index"));
        }