示例#1
0
        public async Task <ActionResult> AddUser_Role([FromBody] User_RoleInputModel model)
        {
            if (model == null || model.Id < 1)
            {
                return(BadRequest());
            }

            return(Ok(await userStorage.User_RoleAdd(User_RoleMapper.ToDataModel(model))));
        }
示例#2
0
        public async Task <ActionResult> AddUserAsStudent([FromBody] UserLoginPassInputModel model)
        {
            if (model == null || model.Id < 1)
            {
                return(BadRequest("Uncorrect input data"));
            }
            model.Password = Hashing.HashUserPassword(model.Password);
            await userStorage.AddPasswordLoginToUser(UserPassLoginMapper.FromInputModel(model));

            User_RoleInputModel userRole = new User_RoleInputModel();

            userRole.UserId = model.Id;
            userRole.RoleId = 251;
            await userStorage.User_RoleAdd(User_RoleMapper.ToDataModel(userRole));

            return(Ok());
        }