コード例 #1
0
        public ActionResult AddTag(AddTag objAddTag)
        {
            AwsS3Client     s3Client = new AwsS3Client();
            List <S3Bucket> buckets  = new List <S3Bucket>();
            List <Tag>      Tags     = new List <Tag>();
            var             result   = s3Client.getBucketList();

            if (!result.Error)
            {
                buckets = result.Data as List <S3Bucket>;
            }
            ViewBag.Buckets = buckets;

            var existingTagsResult = s3Client.getBuckettagging(objAddTag.BucketName);

            if (!existingTagsResult.Error)
            {
                Tags = existingTagsResult.Data as List <Tag>;
            }

            Tags.Add(new Tag()
            {
                Key = objAddTag.key, Value = objAddTag.value
            });

            var AddTagsResult = s3Client.addBucketTagging(objAddTag.BucketName, Tags);

            if (!AddTagsResult.Error)
            {
                RedirectToAction("SearchTag", new { BucketName = objAddTag.BucketName });
            }

            return(View());
        }
コード例 #2
0
        public ActionResult SearchTag(string BucketName)
        {
            AwsS3Client s3Client = new AwsS3Client();

            List <S3Bucket> buckets = new List <S3Bucket>();
            List <Tag>      Tags    = new List <Tag>();

            var result = s3Client.getBucketList();

            if (!result.Error)
            {
                buckets = result.Data as List <S3Bucket>;
            }

            ViewBag.Buckets = buckets;

            var tagresult = s3Client.getBuckettagging(BucketName);

            if (!tagresult.Error)
            {
                Tags = tagresult.Data as List <Tag>;
            }

            return(View("Index", Tags));
        }