Example #1
0
 public static bool EditAdminFirst(AdminUser model)
 {
     using (DeneysanContext db = new DeneysanContext())
     {
         try
         {
             AdminUser record = db.AdminUser.Where(d => d.AdminUserId == model.AdminUserId).SingleOrDefault();
             if (record != null)
             {
                 record.Email = model.Email;
                 record.Password = model.Password;
                 db.SaveChanges();
                 return true;
             } else return false;
         }
         catch (Exception ex)
         {
             return false;
         }
     }
 }
Example #2
0
        public ActionResult AdminSettings(AdminUser model, string txtpassword)
        {
            var record = AccountManager.GetAdminFirst();
            if (record == null)
            {
                ViewBag.nullsetting = true;
                model.Password = txtpassword;
                ViewBag.ProcessMessage = AccountManager.EditAdminFirst(model);
                return View(model);
            }
            else
            {
                if (!string.IsNullOrEmpty(txtpassword))
                    model.Password = txtpassword;
                else
                    model.Password = record.Password;

                ViewBag.nullsetting = false;
                model.AdminUserId = record.AdminUserId;
                ViewBag.ProcessMessage = AccountManager.EditAdminFirst(model);
            }

            return View(AccountManager.GetAdminFirst());
        }