Ejemplo n.º 1
0
        public ActionResult Edit(int id, detail ob)
        {
            try
            {
                using (SD info = new SD())
                {
                    info.Entry(ob).State = EntityState.Modified;
                    info.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Ejemplo n.º 2
0
        public ActionResult Create(detail ob)
        {
            try
            {
                using (var record = new SD())
                {
                    record.details.Add(ob);
                    record.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Ejemplo n.º 3
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                using (SD info = new SD())
                {
                    detail ob = info.details.Where(x => x.id == id).FirstOrDefault();
                    info.details.Remove(ob);
                    info.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }