public IActionResult CreateContentType([FromBody] ContentType contentType) { try { if (contentType == null || string.IsNullOrEmpty(contentType.Name)) { return(BadRequest("Invalid parameter")); } if (_contentTypeRepository.GetContentType(contentType.Name) != null) { return(BadRequest("Content type already exist")); } var result = _contentTypeRepository.CreateContentType(contentType); if (result != null) { return(Ok(result)); } return(NotFound()); } catch (Exception ex) { _logger.LogError(string.Format("Error occured while creating layout type"), ex); return(new StatusCodeResult(StatusCodes.Status500InternalServerError)); } }
public async Task <ContentType> GetItem(string contentTypeId) { var result = _contentTypeRepository.GetContentType(Guid.Parse(contentTypeId)); return(await Task.FromResult(result)); }