public IActionResult Edit(int?id) { log.Info(nameof(DocumentTypesController.Edit)); if (id == null) { log.Warn(nameof(DocumentTypesController.Edit) + " id is null"); return(NotFound()); } try { var documentType = documentTypeService.GetDocumentTypeById(id.Value); if (documentType == null) { log.Warn(nameof(DocumentTypesController.Edit) + " documentType is null"); return(NotFound()); } return(View(documentType)); } catch (Exception e) { log.Error(e); return(BadRequest()); } }
public IActionResult GetDocumentTypeById([SwaggerParameter("Int", Required = true)] int id) { log.Info(nameof(GetDocumentTypeById)); try { var documentType = documentTypesService.GetDocumentTypeById(id); if (documentType == null) { log.Warn(nameof(GetDocumentTypeById) + " document type is null"); return(NotFound()); } return(Ok(documentType)); } catch (Exception e) { log.Error(e); return(BadRequest()); } }