public ActionResult Index(LoginUserModel loginDetails)
        {
            if (ModelState.IsValid)
            {
                UserAccessServiceClient client          = new UserAccessServiceClient();
                UserAccessData          retrievedResult = new UserAccessData();
                var response = client.AuthenticateUser(new UserAccessData()
                {
                    UserName = loginDetails.UserName,
                    Password = loginDetails.Password
                });
                if (response.Message == ConstantsModel.SuccessMessage)
                {
                    retrievedResult = response.Data;
                    return(RedirectToAction("index", "home", new { loggedIn = retrievedResult.UserType.ToString(), userId = retrievedResult.UserId }));
                }
                if (response.Message == "NoUserFound")
                {
                    ViewBag.ErrorMessage = "Incorrect username or passoword";
                    return(View());
                }

                else
                {
                    return(RedirectToAction("index", "login"));
                }
            }
            else
            {
                return(RedirectToAction("index", "login"));
            }
        }
Exemplo n.º 2
0
 public ResponseMessageData <UserAccessData> AuthenticateUser(UserAccessData loginInfo)
 {
     if (loginInfo != null)
     {
         UserAccessData result = userRepo.UserLogin(loginInfo);
         if (result.UserName != null)
         {
             response = new ResponseMessageData <UserAccessData>()
             {
                 Data    = result,
                 Message = "Success"
             };
         }
         else
         {
             response = new ResponseMessageData <UserAccessData>()
             {
                 Data    = null,
                 Message = "NoUserFound"
             };
         }
         return(response);
     }
     else
     {
         response = new ResponseMessageData <UserAccessData>()
         {
             Data    = null,
             Message = "NoData"
         };
         return(response);
     }
 }
Exemplo n.º 3
0
        public IActionResult ProcessInformation(UserAccessData useraccessdata)
        {
            //Our main model which is untouched
            UserAccess user = new UserAccess();

            user.AppPermissionId       = Convert.ToInt32(useraccessdata.appPermissionId);
            user.RequestAccessId       = Convert.ToInt32(useraccessdata.requestAccessId);
            user.BusinessJustification = useraccessdata.BusinessJustification;

            //Now for every container list, do your processing
            foreach (var containerid in useraccessdata.containerIds)
            {
                //Insert in your DB here
                //var insert = CallDBInsert(user);
            }
            return(View());
        }
Exemplo n.º 4
0
 public ResponseMessageData <UserAccessData> GetSignupInfo(UserAccessData signupInfo)
 {
     if (signupInfo != null)
     {
         response = new ResponseMessageData <UserAccessData>()
         {
             Data    = userRepo.UserSignup(signupInfo).Result,
             Message = "Success"
         };
         return(response);
     }
     else
     {
         response = new ResponseMessageData <UserAccessData>()
         {
             Data    = null,
             Message = "NoData"
         };
         return(response);
     }
 }
     public UserAccessData UserLogin(UserAccessData userDetails)
     {
         using (UAS_SystemEntities dbContext = new UAS_SystemEntities())
         {
             UAS_User_Details retrivedUser = dbContext.UAS_User_Details.SingleOrDefault(user => user.UserName == userDetails.UserName && user.Upassword == userDetails.Password);
             if (retrivedUser != null)
             {
                 return(new UserAccessData()
                 {
                     UserId = retrivedUser.UserId,
                     UserName = retrivedUser.UserName,
                     UserType = retrivedUser.UserType
                 });
             }
             else
             {
                 return new UserAccessData()
                        {
                        }
             };
         }
     }
 }
        public async Task <UserAccessData> UserSignup(UserAccessData loginDetails)
        {
            using (UAS_SystemEntities db = new UAS_SystemEntities())
            {
                int result = 0;
                UAS_User_Details signup = new UAS_User_Details();
                signup.UserName  = loginDetails.UserName;
                signup.UserType  = loginDetails.UserType;
                signup.Email     = loginDetails.Email;
                signup.Upassword = loginDetails.Password;
                try
                {
                    db.Set <UAS_User_Details>().Add(signup);
                    result = await db.SaveChangesAsync();

                    db.Dispose();
                    if (result == 1)
                    {
                        return(loginDetails);
                    }
                    else
                    {
                        return(null);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("Exception", e);
                    return(null);
                }
                finally
                {
                    db.Dispose();
                }
            }
        }
Exemplo n.º 7
0
        public async ValueTask <OperationResult <CompletedResult> > AddAccess([FromServices] IKeyVaultLogic keyVault, string secretName, [FromBody] UserAccessData data)
        {
            var result = await keyVault.AddSecretAccess(HttpContext.User, secretName, data.UserId, data);

            SetStatusCode(result);
            return(result);
        }
Exemplo n.º 8
0
 public int DeleteUserAccess(string username)
 {
     return(UserAccessData.Delete(username));
 }
Exemplo n.º 9
0
 public int DeleteUserAccess(UserAccess user)
 {
     return(UserAccessData.Delete(user));
 }
Exemplo n.º 10
0
 public int InsertUserAccess(UserAccess user)
 {
     return(UserAccessData.Insert(user));
 }
Exemplo n.º 11
0
 public int UpdateUserAccountByUserId(UserAccess user)
 {
     return(UserAccessData.UpdateByUserId(user));
 }
Exemplo n.º 12
0
 public List <UserAccess> GetAllUserAccounts()
 {
     return(UserAccessData.GetAll());
 }
Exemplo n.º 13
0
 // USER ACCOUNTS
 public UserAccess GetUserAccountByUserName(string userName)
 {
     return(UserAccessData.GetByUserName(userName));
 }
        public async Task <ResponseMessageData <UserApplicationData> > GenerateApplicationToken(UserAccessData user)
        {
            Random generator     = new Random();
            int    applicationId = generator.Next(200, 20000);
            UserApplicationData applicationData = new UserApplicationData()
            {
                ApplicationId     = applicationId,
                ApplicationStatus = "Pending",
                UserId            = user.UserId
            };
            UserApplicationData result = await appRepo.StoreApplication(applicationData);

            return(new ResponseMessageData <UserApplicationData>()
            {
                Message = "Success",
                Data = result
            });
        }