Beispiel #1
0
 public ActionResult Edit(user userModel, FormCollection form)
 {
     try
     {
         // TODO: Add update logic here
         using (smsfingerDB dbModel = new smsfingerDB())
         {
             var UserData = dbModel.users.Where(x => x.id == userModel.id).FirstOrDefault();
             if (UserData != null)
             {
                 UserData.firstname            = userModel.firstname;
                 UserData.lastname             = userModel.lastname;
                 UserData.gender               = userModel.gender;
                 UserData.email                = userModel.email;
                 UserData.acid                 = userModel.acid;
                 UserData.remarks              = userModel.remarks;
                 UserData.status               = Convert.ToInt32("" + form["SelectedItem"]);
                 dbModel.Entry(UserData).State = System.Data.EntityState.Modified;
                 dbModel.SaveChanges();
             }
             else
             {
                 ViewBag.Message = "Invalid Attempt";
                 return(View());
             }
         }
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         ViewBag.Message = "" + ex.Message;
         return(View());
     }
 }
Beispiel #2
0
 public ActionResult Delete(user userModel)
 {
     try
     {
         // TODO: Add delete logic here
         using (smsfingerDB dbModel = new smsfingerDB())
         {
             var userData = dbModel.users.Where(x => x.id == userModel.id).FirstOrDefault();
             if (userData != null)
             {
                 userData.remarks = "" + userModel.remarks;
                 userData.status  = -1;
                 dbModel.Entry(userData).State = System.Data.EntityState.Modified;
                 dbModel.SaveChanges();
             }
             else
             {
                 ViewBag.Message = "Invalid Attempt";
                 return(View());
             }
         }
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         ViewBag.Message = "" + ex.Message;
         return(View());
     }
 }
        public ActionResult Edit(accout accModel, FormCollection form)
        {
            try
            {
                // TODO: Add update logic here

                using (smsfingerDB dbModel = new smsfingerDB())
                {
                    var accountData = dbModel.accouts.Where(x => x.id == accModel.id).FirstOrDefault();
                    if (accountData != null)
                    {
                        accountData.acname               = accModel.acname;
                        accountData.mpoc                 = accModel.mpoc;
                        accountData.mobileno             = accModel.mobileno;
                        accountData.email                = accModel.email;
                        accountData.remarks              = accModel.remarks;
                        accountData.status               = Convert.ToInt32("" + form["SelectedItem"]);
                        dbModel.Entry(accountData).State = System.Data.EntityState.Modified;
                        dbModel.SaveChanges();
                    }
                    else
                    {
                        ViewBag.Message = "Invalid Attempt";
                        return(View());
                    }
                }
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                ViewBag.Message = "" + ex.Message;
                return(View());
            }
        }