예제 #1
0
        public async Task <IActionResult> CreateDocument([FromBody] DocumentRequestModel model)
        {
            model.Validate();
            bool result = await _docManager.AddDocumentType(new DocumentTypeModel
            {
                DocumentCode = model.DocumentCode,
                DocumentName = model.DocumentName,
                IsRequired   = model.IsRequired
            });

            return(Ok(new ResponseModel <object>
            {
                RequestSuccessful = true,
                ResponseCode = ResponseCodes.Successful,
                Message = "Document has been created successfully.",
                ResponseData = result
            }));
        }
예제 #2
0
        public async Task <IActionResult> UpdateDocument(long Id, [FromBody] DocumentRequestModel model)
        {
            model.Validate();
            if (Id == default(long))
            {
                throw new BadRequestException("Invalid request. Document is required");
            }

            bool result = await _docManager.UpdateDocumentType(new DocumentTypeModel
            {
                DocumentCode = model.DocumentCode,
                DocumentName = model.DocumentName,
                IsRequired   = model.IsRequired,
                Id           = Id
            });

            return(Ok(new ResponseModel <object>
            {
                RequestSuccessful = true,
                ResponseCode = ResponseCodes.Successful,
                Message = "Document has been updated successfully.",
                ResponseData = result
            }));
        }