Example #1
0
 public ActionResult EnableUser(Enableusr enable)
 {
     try
     {
         paresetEntities db  = new paresetEntities();
         var             obj = db.Userinfoes.Where(c => c.username == enable.username).First();
         obj.failurecount  = 0;
         obj.AdminApproved = true;
         db.Entry(obj).CurrentValues.SetValues(obj);
         db.SaveChanges();
         ViewBag.Message = "Success1";
     }
     catch (Exception cex)
     {
         ViewBag.Message = "Error";
     }
     return(View());
 }
        public JsonResult GetUsrEnbledt(Enableusr obj)
        {
            Enableusr usredt = new Enableusr();

            try
            {
                paresetEntities db   = new paresetEntities();
                var             obj1 = db.Userinfoes.Where(c => c.username == obj.username).First();

                usredt.username = obj1.username.ToString();

                usredt.adminapproved = bool.Parse(obj1.AdminApproved.ToString());
                usredt.failuredis    = obj1.failurecount;
                usredt.errormsg      = "Success";
                return(Json(usredt, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                usredt.errormsg = "Error";
                return(Json(usredt, JsonRequestBehavior.AllowGet));
            }
        }