Пример #1
0
        // GET: plastico/Delete/5


        public ActionResult Details(int id)
        {
            PlasticoBLL oBLL    = new PlasticoBLL();
            plastico    tarjeta = oBLL.Retrieve(id);

            return(View(tarjeta));
        }
Пример #2
0
        public plastico Retrieve(int id)
        {
            plastico Result = null;

            using (var r = new Repository <plastico>())
            {
                Result = r.Retrieve(p => p.id_tarjeta == id);
            }
            return(Result);
        }
Пример #3
0
        public plastico Create(plastico tarjeta)
        {
            plastico Result = null;

            using (var r = new Repository <plastico>())
            {
                plastico tmp = r.Retrieve(
                    p => p.numero_tarjeta == tarjeta.numero_tarjeta);
                if (tmp == null)
                {
                    Result = r.Create(tarjeta);
                }
                else
                {
                    throw (new Exception());
                }
            }
            return(Result);
        }
Пример #4
0
        public bool Edit(plastico tarjeta)
        {
            bool Result = false;

            using (var r = new Repository <plastico>())
            {
                plastico tmp = r.Retrieve(
                    p => p.numero_tarjeta == tarjeta.numero_tarjeta &&
                    p.id_tarjeta != tarjeta.id_tarjeta);
                if (tmp == null)
                {
                    Result = r.Update(tarjeta);
                }
                else
                {
                    throw (new Exception());
                }
            }
            return(Result);
        }
Пример #5
0
        public ActionResult Edit(plastico tarjeta)
        {
            ActionResult Result;

            try {
                if (ModelState.IsValid)
                {
                    PlasticoBLL oBLL = new PlasticoBLL();
                    oBLL.Edit(tarjeta);
                    Result = RedirectToAction("Index");
                }
                else
                {
                    Result = View(tarjeta);
                }
                return(Result);
            } catch (Exception e) {
                return(View(tarjeta));
            }
        }