예제 #1
0
        public async Task <IActionResult> CreateCatalogAsync(CatalogsEntity catalog)
        {
            if (!_catalogService.CheckIfCatalogExit(catalog))
            {
                var model = await _catalogService.CreateCatalogAsync(catalog);

                var location = _linkGanarator.GetPathByAction("GetCatalogByIdAsync", "Catalogs", new { id = model.CatalogId });
                return(Created(location, model));
            }
            else
            {
                return(BadRequest("catalog has already been created"));
            }
        }