Example #1
0
        //[Rahul - update 20Apr21]
        //public async Task<IActionResult> InsertLicensedUser(IndexUserAuthenticationsVM obj)
        public JsonResult InsertLicensedUser(IndexUserAuthenticationsVM obj)
        {
            var    result  = (dynamic)null;
            string message = (dynamic)null;

            try
            {
                if (obj.Users != null)
                {
                    var Users = new GetLicenses_Users()
                    {
                        OurEduId         = obj.Users.OurEduId,
                        Password         = obj.Users.Password,
                        LastEntryDate    = DateTime.Now,
                        LastLogoutDate   = null,
                        GenderId         = obj.Users.GenderId,
                        FirstName        = obj.Users.FirstName,
                        LastName         = obj.Users.LastName,
                        IP300X200        = null,
                        IP600X400        = null,
                        EmailAddress     = obj.Users.EmailAddress,
                        ContactNo        = obj.Users.ContactNo,
                        DateOfBirth      = null,
                        IsForgetPassword = false,
                        IsActive         = obj.Users.IsActive,
                    };

                    var UserAuthentications = new GetLicenses_UserAuthentications()
                    {
                        ActorId  = obj.UserAuthentications.ActorId,
                        UserId   = obj.Users.Id,
                        IsActive = obj.Users.IsActive,
                    };

                    var model = new GetLicenses()
                    {
                        Users = Users,
                        UserAuthentications = UserAuthentications
                    };
                    //await Task.Run(() => _userAuthentication.InsertLicensesedUser(model));
                    message = _userAuthentication.InsertLicensesedUser(model);
                    result  = Json(new { success = true, Message = message });
                }
            }
            catch (Exception ex)
            {
                //return BadRequest();
                result = Json(new { success = false, Message = "ERROR101:Students/InsertStudent - " + ex.Message });
            }
            //return RedirectToAction("LicensedUserList");
            return(result);
        }
Example #2
0
        public string InsertLicensesedUser(GetLicenses obj)
        {
            string retrurnResult = (dynamic)null;

            try
            {
                if (obj != null)
                {
                    if (obj.Users != null)
                    {
                        var Users = new GetLicenses_Users()
                        {
                            OurEduId         = obj.Users.OurEduId,
                            Password         = obj.Users.Password,
                            LastEntryDate    = DateTime.Now,
                            LastLogoutDate   = null,
                            GenderId         = obj.Users.GenderId,
                            FirstName        = obj.Users.FirstName,
                            LastName         = obj.Users.LastName,
                            IP300X200        = null,
                            IP600X400        = null,
                            EmailAddress     = obj.Users.EmailAddress,
                            ContactNo        = obj.Users.ContactNo,
                            DateOfBirth      = null,
                            IsForgetPassword = false,
                            IsActive         = obj.Users.IsActive
                        };
                        _usersRepo.Insert(Users);
                        retrurnResult = "Saved";
                    }
                    var getLastId = _usersRepo.GetLastId();
                    var usersList = _usersRepo.Get(getLastId);
                    if (obj.UserAuthentications != null)
                    {
                        var UserAthentications = new GetLicenses_UserAuthentications()
                        {
                            ActorId  = obj.UserAuthentications.ActorId,
                            UserId   = getLastId,
                            IsActive = obj.Users.IsActive
                        };
                        _userAuthenticationsRepo.Insert(UserAthentications);
                        retrurnResult = "Saved";
                    }
                }
            }
            catch (Exception ex)
            {
                retrurnResult = "ERROR102: userServ/InsertuserList -" + ex.Message;
            }
            return(retrurnResult);
        }
Example #3
0
        public GetLicenses GetLicenses()
        {
            var model = new GetLicenses();

            try
            {
                var UsersList = _usersRepo.GetAll().ToList();
                var userAuthenticationList = _userAuthenticationsRepo.GetAll().ToList();
                var ActorList = _actorsRepo.GetAll().ToList();
                var query     = (from _userAuthentication in userAuthenticationList
                                 join _User in UsersList on _userAuthentication?.UserId equals _User?.Id
                                 join _actor in ActorList on _userAuthentication?.ActorId equals _actor?.Id
                                 select new { _userAuthentication, _User, _actor });

                var list = new List <GetLicenses_UserAuthentications>();
                foreach (var item in query)
                {
                    var temp = new GetLicenses_UserAuthentications()
                    {
                        Id        = item._userAuthentication.Id,
                        ActorId   = item._userAuthentication.ActorId,
                        Actor     = item._actor.Name,
                        UserId    = item._userAuthentication.UserId,
                        IsActive  = item._userAuthentication.IsActive,
                        UserName  = item._User.FirstName + " " + item._User.LastName,
                        OurEduId  = item._User.OurEduId,
                        FirstName = item._User.FirstName,
                        LastName  = item._User.LastName,
                        Password  = item._User.Password,
                        Email     = item._User.EmailAddress,
                        Contact   = item._User.ContactNo,
                        GenderId  = item._User.GenderId
                    };
                    list.Add(temp);
                }
                ;
                model = new GetLicenses()
                {
                    _UserAuthentications = list
                };
            }
            catch (Exception ex)
            {
                var test = ex.Message;
            }
            return(model);
        }