Пример #1
0
        public async Task <ActionResult> Get(int id)
        {
            await AuthenticateAdmin();

            ProfileDataDto data = await Get <GetProfileDataQuery>().Execute(id);

            return(Json(data));
        }
Пример #2
0
        public async Task <ActionResult> GetPersonalData()
        {
            User user = await AuthenticateUser();

            ProfileDataDto result = await Get <GetProfileDataQuery>().Execute(user.Id);

            return(Json(result));
        }
Пример #3
0
        public async Task <ActionResult> DeletePersonalDocument(int userId, int fileid)
        {
            await AuthenticateAdmin();

            OperationResult cmdResult = await Get <DeleteFileCommand>().Execute((userId, fileid));

            if (!cmdResult.Success)
            {
                return(BadRequest());
            }

            ProfileDataDto result = await Get <GetProfileDataQuery>().Execute(userId);

            return(Json(result));
        }
Пример #4
0
        public async Task <ActionResult> Update([FromBody] ProfileDataDto data)
        {
            await AuthenticateAdmin();

            OperationResult cmdResult = await Get <UpdateCandidateCommand>().Execute(data);

            if (!cmdResult.Success)
            {
                return(BadRequest());
            }

            ProfileDataDto qResult = await Get <GetProfileDataQuery>().Execute(data.UserId);

            return(Json(qResult));
        }
Пример #5
0
        public async Task <ActionResult> UpdatePersonalData([FromBody] ProfileDataDto personalData)
        {
            User user = await AuthenticateUser();

            OperationResult cmdResult = await Get <AddOrUpdateProfileDataCommand>().Execute(
                new AddOrUpdateProfileDataCommandRequest()
            {
                UserId = user.Id,
                Data   = personalData
            });

            if (cmdResult.Success)
            {
                ProfileDataDto result = await Get <GetProfileDataQuery>().Execute(user.Id);

                return(Json(result));
            }
            else
            {
                return(BadRequest());
            }
        }