Пример #1
0
        public bool ValidateAccessRights(RequestAdmin requestAdmin)
        {
            if (_context.SessionTokens.Any(x => x.AdminId == requestAdmin.AdminId && x.AccessToken == requestAdmin.AccessToken))
            {
                return(true);
            }

            return(false);
        }
Пример #2
0
        public ActionResult RequestAdmin(RequestDataModel dt)
        {
            CASDatabaseEntities db         = new CASDatabaseEntities();
            RequestAdmin        objRequest = new RequestAdmin();

            List <SelectListItem> list = new List <SelectListItem>();
            var getData = db.RoleDetails.ToList();

            foreach (var item in getData)
            {
                if (item.RoleID == 1 || item.RoleID == 4)
                {
                    continue;
                }
                else
                {
                    list.Add(new SelectListItem
                    {
                        Text  = item.RoleName,
                        Value = item.RoleID.ToString()
                    });
                }
            }
            dt.ListRole = list;

            if (ModelState.IsValid)
            {
                var getEmail = db.Users.Where(m => m.EmailID == dt.EmailID).FirstOrDefault();
                if (getEmail != null)
                {
                    ViewBag.text = "This E-mail ID is already registered.";
                }
                else
                {
                    objRequest.FirstName = dt.FirstName;
                    objRequest.LastName  = dt.LastName;
                    objRequest.EmailID   = dt.EmailID;
                    objRequest.RoleID    = dt.RoleID;
                    objRequest.Status    = "Requested";

                    db.RequestAdmins.Add(objRequest);
                    db.SaveChanges();

                    ViewBag.text = "Request has been sent. Please wait for the E-mail.";
                }
            }
            return(View(dt));
        }
Пример #3
0
 public ObjectResultEx EditAdmin(RequestAdmin Param)
 {
     return(ObjectResultEx.Instance(SystemService.EditAdmin(Param), 1, RetrunMessge.SUCCESS, HttpCode.Success));
 }