Пример #1
0
        public async Task <JsonResult> STInsert()
        {
            var id     = Guid.Parse(Request.Form["id"]);
            var name   = Request.Form["name"];
            var desc   = Request.Form["desc"];
            var oid    = Guid.Parse(Request.Form["oid"]);
            var aid    = Guid.Parse(Request.Form["aid"]);
            var dtid   = Guid.Parse(Request.Form["dtid"]);
            var catID  = Guid.Parse(Request.Form["cid"]);
            var uid    = Guid.Parse(Request.Form["uid"]);
            var sadmin = Guid.Parse("3c35cccc-d48d-4721-9283-d58faeac6cc1");

            try {
                if (!UserAccessLevelService.HasAccess(uid, sadmin))
                {
                    return(Failed(MessageUtilityService.ContactAdmin("Content")));
                }
                if (StatusTypesReferencesService.Insert(id, name, desc, oid, aid, dtid, catID))
                {
                    return(Success(id.ToString()));
                }
                DateTimeStorageService.RemoveAdmin(dtid);
                return(Failed(MessageUtilityService.FailedInsert("")));
            } catch {
                DateTimeStorageService.RemoveAdmin(dtid);
                return(Failed(MessageUtilityService.ServerError()));
            }
        }
 public async Task <JsonResult> UGetAdmin()
 {
     try {
         var email = Request.Form["email"];
         var pass  = Request.Form["pass"];
         if (UsersService.HasUserAccess(email, pass, superAdmin))
         {
             var data = UsersService.GetAll();
             return(Success(UsersService.SetSubDatasAdmin(data)));
         }
         return(Failed(MessageUtilityService.ContactAdmin("Content")));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
        public async Task <JsonResult> QIEnterCode()
        {
            try {
                var code = Request.Form["qc"];
                var aid  = Guid.Parse(Request.Form["aid"]);
                var uid  = Guid.Parse(Request.Form["uid"]);

                var data = QuizInfoService.GetByQuizCode(code, aid);
                var vms  = QuizInfoService.SetSubData(data, aid);
                if (vms.QuizStatus.Name.Equals("Closed"))
                {
                    return(Failed(MessageUtilityService.ContactAdmin("Quiz")));
                }
                return(Success(vms));
            } catch { return(Failed(MessageUtilityService.ServerError())); }
        }
 public async Task <JsonResult> UALGetByUID()
 {
     try {
         var email = Request.Form["email"];
         var pass  = Request.Form["pass"];
         var uid   = Guid.Parse(Request.Form["uid"]);
         if (UsersService.HasUserAccess(email, pass, superAdmin))
         {
             var data = UserAccessLevelService.GetByUID(uid, false);
             return(Success(UserAccessLevelService.SetSubDatasAdmin(data)));
         }
         return(Failed(MessageUtilityService.ContactAdmin("Content")));
     } catch {
         return(Failed(MessageUtilityService.ServerError()));
     }
 }
Пример #5
0
 public async Task <JsonResult> SLAuthIsAllowAccess()
 {
     try {
         var uemail   = Request.Form["email"];
         var url      = Request.Form["url"];
         var data     = UsersService.GetByEmailAddress(uemail);
         var dataLink = SecurityLinksService.GetByURL(url);
         if (data != null && dataLink != null && dataLink.OwnerID == data.ID)
         {
             //update access into true
             SecurityLinksService.Remove(dataLink.ID);
             UsersService.UpdateIsAllowAccess(data.ID, true);
             return(Success("Success Authorizing this account!"));
         }
         return(Failed(MessageUtilityService.ContactAdmin("content")));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
Пример #6
0
 public async Task <JsonResult> SLInsert()
 {
     try
     {
         var id   = Guid.Parse(Request.Form["id"]);
         var cid  = Guid.Parse(Request.Form["cid"]);
         var code = Request.Form["code"];
         //get url using asp.net
         var url = Request.Form["url"];
         var oid = Guid.Parse(Request.Form["oid"]);
         //check if emailAddress user.ID == oid
         if (SecurityLinksService.Insert(id, cid, url + code, oid))
         {
             return(Success(id.ToString()));
         }
         return(Failed(MessageUtilityService.ContactAdmin("updating this content")));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
Пример #7
0
        public async Task <JsonResult> STGet()
        {
            //user id to determine accessLevel
            var uid    = Guid.Parse(Request.Form["id"]);
            var sadmin = Guid.Parse("3c35cccc-d48d-4721-9283-d58faeac6cc1");

            try {
                //check if uid has super admin access
                if (UserAccessLevelService.HasAccess(uid, sadmin))
                {
                    var data = StatusTypesReferencesService.GetAll();
                    return(Success(StatusTypesReferencesService.SetSubDatasAdmin(data)));
                }
                return(Failed(MessageUtilityService.ContactAdmin("Error")));
            } catch {
                return(Failed(MessageUtilityService.ServerError()));
            }
        }
Пример #8
0
 public async Task <JsonResult> SLAuthUser()
 {
     try {
         var url         = Request.Form["url"];
         var email       = Request.Form["email"];
         var newPassword = Request.Form["npass"];
         var data        = UsersService.GetByEmailAddress(email);
         var dataLink    = SecurityLinksService.GetByURL(url);
         if (data != null && dataLink != null && dataLink.OwnerID == data.ID)
         {
             if (UsersService.UpdatePassword(data.ID, UsersService.GenerateHashPassword(newPassword)))
             {
                 SecurityLinksService.Remove(dataLink.ID);
                 return(Success("Success Updating Password"));
             }
         }
         return(Failed(MessageUtilityService.ContactAdmin("content")));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
Пример #9
0
 public async Task <JsonResult> SSInsert()
 {
     try {
         var id    = Guid.Parse(Request.Form["id"]);
         var aid   = Guid.Parse(Request.Form["aid"]);
         var name  = Request.Form["name"];
         var score = int.Parse(Request.Form["score"]);
         var tz    = Request.Form["tz"];
         var dtid  = Guid.NewGuid();
         var cid   = Guid.Parse(Request.Form["cid"]);
         if (DateTimeStorageService.InsertByTZ(dtid, id, aid, tz, cid))
         {
             if (ScoreStorageService.Insert(id, aid, name, score, dtid))
             {
                 return(Success(id.ToString()));
             }
         }
         return(Failed(MessageUtilityService.ContactAdmin("content")));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
 public async Task <JsonResult> UUpdateAccess()
 {
     try {
         var email = Request.Form["email"];
         var pass  = Request.Form["pass"];
         //super admin
         var uid    = Guid.Parse(Request.Form["uid"]);
         var access = Boolean.Parse(Request.Form["iaa"]);
         if (UsersService.HasUserAccess(email, pass, superAdmin))
         {
             var data = UsersService.GetByID(uid);
             if (UsersService.Update(data.ID, data.Firstname, data.Lastname, data.MiddleName, data.Address, data.EmailAddress, data.Password, data.ContactNumber, access, data.ApplicationRegistered, data.ProfileImageID, data.DateTimeStorageID))
             {
                 return(Success(uid.ToString()));
             }
             return(Failed(MessageUtilityService.FailedUpdate("User")));
         }
         return(Failed(MessageUtilityService.ContactAdmin("Modify Content")));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }