public ActionResult GetData()
        {
            RSDetails details = new RSDetails(_Context);
            var       rsList  = details.GetDetailsOfRemoteServers();

            ViewBag.currentUser = HttpContext.Session.GetString("UserName");
            return(View("RemoteServerDetails", rsList));
        }
Esempio n. 2
0
        public void UpdateAllDetailsOfRemoteServers(RSDetails rSDetails)
        {
            // _Context.RemoteServerAccessInfo.Attach(rSDetails);
            var updtdata = _Context.RemoteServerAccessInfo.FirstOrDefault(x => x.ID == rSDetails.ID);

            updtdata.USER_S_ACCESS_BY = rSDetails.USER_S_ACCESS_BY;
            updtdata.USER_P_ACCESS_BY = rSDetails.USER_P_ACCESS_BY;
            _Context.RemoteServerAccessInfo.Update(updtdata);
            _Context.SaveChanges();
        }
 public JsonResult UpdateData([FromBody] RSDetails rSDetails)
 {
     try
     {
         rSDetails.UpdateDetailsOfRemoteServers(rSDetails);
         return(Json(Url.Action("GetData", "RemoteServerDetails")));
     }
     catch (Exception ex)
     {
         return(Json(ex));
     }
 }
        // GET: Login
        public ActionResult Login()
        {
            bool   testUser = false;
            string systemUserName;

            if (testUser)
            {
                systemUserName = "******";
            }
            else
            {
                systemUserName = HttpContext.User.Identity.Name.ToString();
            }

            var identity = new ClaimsIdentity(CookieAuthenticationDefaults.AuthenticationScheme, ClaimTypes.Name, ClaimTypes.Role);

            //identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, userName));
            identity.AddClaim(new Claim(ClaimTypes.Name, systemUserName));
            var principal = new ClaimsPrincipal(identity);

            HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal, new AuthenticationProperties
            {
                IsPersistent = false,
                ExpiresUtc   = DateTime.UtcNow.AddHours(20)
            });

            LoginModel loginModel = new LoginModel(_Context);
            // var systemUser = systemUserName.Replace(@"\", string.Empty);
            var userName = loginModel.GetUserNameFromSystemName(systemUserName);



            HttpContext.Session.SetString("UserName", userName);
            ViewBag.currentUser = userName;

            RSDetails rSDetails = new RSDetails(_Context);
            var       rsList    = rSDetails.GetDetailsOfRemoteServers();

            return(View("../RemoteServerDetails/RemoteServerDetails", rsList));
        }