Пример #1
0
        public async Task <ActionResult <SelfDeclarationDocument> > CreateSelfDeclarationDocument(int enrolleeId, SelfDeclarationDocument selfDeclarationDocument)
        {
            var record = await _enrolleeService.GetPermissionsRecordAsync(enrolleeId);

            if (record == null)
            {
                return(NotFound(ApiResponse.Message($"Enrollee not found with id {enrolleeId}")));
            }
            if (!record.EditableBy(User))
            {
                return(Forbid());
            }

            var sdd = await _enrolleeService.AddSelfDeclarationDocumentAsync(enrolleeId, selfDeclarationDocument);

            return(Ok(ApiResponse.Result(sdd)));
        }
Пример #2
0
        public async Task <ActionResult <SelfDeclarationDocument> > createSelfDeclarationDocument(int enrolleeId, SelfDeclarationDocument selfDeclarationDocument)
        {
            var enrollee = await _enrolleeService.GetEnrolleeAsync(enrolleeId);

            if (enrollee == null)
            {
                return(NotFound(ApiResponse.Message($"Enrollee not found with id {enrolleeId}")));
            }

            if (!User.CanEdit(enrollee))
            {
                return(Forbid());
            }

            var sdd = await _enrolleeService.AddSelfDeclarationDocumentAsync(enrolleeId, selfDeclarationDocument);

            return(Ok(ApiResponse.Result(sdd)));
        }