示例#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);
        }
示例#2
0
        public async Task <IActionResult> UpdateLicensedUser(IndexUserAuthenticationsVM obj)
        {
            try
            {
                if (obj.Users != null)
                {
                    var Users = new GetLicenses_Users()
                    {
                        Id = obj.Users.UserId,
                        UserAuthenticationId = obj.UserAuthenticationId,
                        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 != null? obj.Users.EmailAddress:"",
                        ContactNo            = obj.Users.ContactNo != null ? obj.Users.ContactNo : "",
                        DateOfBirth          = null,
                        IsForgetPassword     = false,
                        IsActive             = obj.Users.IsActive,
                    };
                    //var UserAuthentications = new GetLicenses_UserAuthentications()
                    //{
                    //    Id = obj.UserAuthentications.Id,
                    //    ActorId = obj.UserAuthentications.ActorId,
                    //    UserId = obj.Users.Id,
                    //    IsActive = obj.Users.IsActive,
                    //};



                    var model = new GetLicenses()
                    {
                        // WebRootPath = _he.WebRootPath,
                        Users = Users
                                //UserAuthentications = UserAuthentications
                    };

                    await Task.Run(() => _userAuthentication.UpdateLicensedUser(model));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest());
            }
            return(RedirectToAction("LicensedUserList"));
        }
示例#3
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);
        }