Esempio n. 1
0
        public async Task Seed(bool isIntegrationTest)
        {
            bool removeIdsSoValuesCanBeGenerated = !isIntegrationTest;

            foreach (var label in TestDataGraph.Labels.LabelsRaw)
            {
                if (removeIdsSoValuesCanBeGenerated)
                {
                    label.LabelId = 0;
                }
                await _labelRepository.Create(label);
            }

            foreach (var artist in TestDataGraph.Artists.ArtistsRaw)
            {
                if (removeIdsSoValuesCanBeGenerated)
                {
                    artist.ArtistId = 0;
                }
                await _artistRepository.Create(artist);
            }

            foreach (var release in TestDataGraph.Releases.ReleasesRaw)
            {
                if (removeIdsSoValuesCanBeGenerated)
                {
                    release.ReleaseId = 0;
                }
                await _releaseRepository.Create(release);
            }
        }
Esempio n. 2
0
        public async Task <ActionResult <Label> > PostLabel(Label label)
        {
            //_context.Labels.Add(label); // Original scaffold call using context directly
            await _repository.Create(label);

            //await _context.SaveChangesAsync(); // Original scaffold call using context directly

            return(CreatedAtAction("GetLabel", new { id = label.LabelId }, label));
        }
        public async Task <IActionResult> Create([Bind("LabelId,Name,WebsiteUrl")] Label label)
        {
            if (ModelState.IsValid)
            {
                //_context.Add(label); // Original scaffold call using context directly
                await _repository.Create(label);

                //await _context.SaveChangesAsync(); // Original scaffold call using context directly
                return(RedirectToAction(nameof(Index)));
            }
            return(View(label));
        }