Exemple #1
0
        public ActionResult Delete(string id, FormCollection fc)
        {
            MyProfile profile = new MyProfile();

            profile.Id = id;
            try
            {
                dbcon.Open();
                int result = MyProfile.CUDProfile(dbcon, "delete", profile);
                dbcon.Close();
                return(RedirectToAction("Index"));
            }
            catch (Exception ex) { throw new Exception(ex.Message); }
        }
Exemple #2
0
 public ActionResult Create(MyProfile profile)
 {
     if (ModelState.IsValid)
     {
         try
         {
             dbcon.Open();
             int result = MyProfile.CUDProfile(dbcon, "create", profile);
             dbcon.Close();
             return(RedirectToAction("Index"));
         }
         catch (Exception ex) { throw new Exception(ex.Message); }
     } //valid data
     ViewBag.errmsg = "Data validation error in Create method";
     return(View("Error"));
 }