Beispiel #1
0
 public ActionResult Delete(Tmp_Contact_Details contactDetail)
 {
     try
     {
         // TODO: Add delete logic here
         var res = (from r in _db.Tmp_Contact_Details where r.Id == contactDetail.Id select r).FirstOrDefault();
         _db.DeleteObject(res);
         _db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Beispiel #2
0
        public ActionResult Create([Bind(Exclude = "Id")] Tmp_Contact_Details contactDetail)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }
            try
            {
                // TODO: Add insert logic here
                _db.AddToTmp_Contact_Details(contactDetail);
                _db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Beispiel #3
0
        //public ActionResult Edit(int id, FormCollection collection)
        public ActionResult Edit(Tmp_Contact_Details contactDetail)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            try
            {
                // TODO: Add update logic here
                var res = (from r in _db.Tmp_Contact_Details where r.Id == contactDetail.Id select r).FirstOrDefault();
                _db.ApplyCurrentValues(res.EntityKey.EntitySetName, contactDetail);
                _db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }