Ejemplo n.º 1
0
        public async Task <IActionResult> AddAsset(CollectionViewModel inputData)
        {
            try
            {
                var asset = inputData.NewAsset;
                asset.Id = Guid.NewGuid();
                var success = await _damsClient.AddAsset(asset, inputData.Collection.Id);

                bool addToCollectionSuccess = false;

                if (success)
                {
                    addToCollectionSuccess = await _damsClient.AddAssetToCollection(asset.Id, inputData.Collection.Id);
                }

                if (addToCollectionSuccess)
                {
                    return(RedirectToAction("Collection", "DAMS", new { id = inputData.Collection.Id.ToString() }));
                }

                return(RedirectToAction("Index", "Error"));
            }
            catch (Exception e)
            {
                return(RedirectToAction("Index", "Error"));
            }
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Collection(string id)
        {
            try
            {
                var collection = await _damsClient.GetCollectionById(new Guid(id));

                var model = new CollectionViewModel
                {
                    Collection = collection
                };
                return(View(model));
            }
            catch (Exception e)
            {
                return(RedirectToAction("Index", "Error"));
            }
        }