Beispiel #1
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());
     }
 }
Beispiel #2
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());
     }
 }
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                string contactname  = collection["contactname"];
                string mobilenumber = collection["mobileno"];
                string email        = collection["email"];

                // TODO: Add insert logic here
                using (smsfingerDB smsDB = new smsfingerDB())
                {
                    contact cdet = new contact();
                    cdet.contactname = "" + contactname;
                    cdet.mobileno    = "" + mobilenumber;
                    cdet.contactname = "" + contactname;
                    cdet.status      = 1;
                    cdet.datecreated = DateTime.Now;

                    smsDB.contacts.Add(cdet);
                    smsDB.SaveChanges();
                }
                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());
            }
        }
 public ActionResult Create(accout accollection)
 {
     try
     {
         // TODO: Add insert logic here
         using (smsfingerDB smsDB = new smsfingerDB())
         {
             accollection.datecreated = DateTime.Now;
             accollection.status      = 1;
             smsDB.accouts.Add(accollection);
             smsDB.SaveChanges();
         }
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         ViewBag.Message = "" + ex.Message;
         return(View());
     }
 }
Beispiel #6
0
 public ActionResult Create(user usermodel, FormCollection form)
 {
     try
     {
         // TODO: Add insert logic here
         using (smsfingerDB objDb = new smsfingerDB())
         {
             usermodel.acid        = Convert.ToInt32("" + form["SelectedItem"]);
             usermodel.datecreated = DateTime.Now;
             usermodel.status      = 1;
             usermodel.usercreated = 1;
             objDb.users.Add(usermodel);
             objDb.SaveChanges();
         }
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         ViewBag.Message = "" + ex.Message;
         return(View());
     }
 }