Example #1
0
        public ActionResult AddTag(string tag, string packageId)
        {
            try
            {
                tag = HttpUtility.UrlDecode(tag);
                _tagsService.AddTag(packageId, tag);

                return(new JsonResult(new
                {
                    success = new
                    {
                        description = $"Tag {tag} was added to package {packageId}"
                    }
                }));
            }
            catch (PackageNotFoundException)
            {
                return(Responses.NotFoundError(this, $"Package ${packageId} not found."));
            }
            catch (Exception ex)
            {
                _log.LogError(ex, "An unexpected error occurred.");
                return(Responses.UnexpectedError());
            }
        }