Beispiel #1
0
        public ActionResult Create([Bind(Include = "ArtistId,Name")] Artist artist)
        {
            if (ModelState.IsValid)
            {
                db.Artists.Add(artist);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(artist));
        }
        public IActionResult Create(Staff staff)
        {
            if (ModelState.IsValid)
            {
                builder.Staff.Add(staff);
                int count = builder.SaveChanges();
                int id    = staff.Id;
                if (id > 0)
                {
                    return(RedirectToAction(nameof(Create), new { isSuccess = true, staff.Id }));
                }
            }
            ViewBag.IsSuccess = false;
            ViewBag.id        = 0;

            return(View(staff));
        }
        public IActionResult Create(Language language)
        {
            if (ModelState.IsValid)
            {
                builder.Language.Add(language);
                int count = builder.SaveChanges();
                int id = language.Id;
                if (id > 0)
                {
                    return RedirectToAction(nameof(Create), new { isSuccess = true, language.Id });
                }
            }

            ViewBag.IsSuccess = false;
            ViewBag.id = 0;
            return View(language);
        }
Beispiel #4
0
        public IActionResult Create(Gender gender)
        {
            if (ModelState.IsValid)
            {
                builder.Gender.Add(gender);
                int count = builder.SaveChanges();
                int id    = gender.Id;
                if (id > 0)
                {
                    return(RedirectToAction(nameof(Create), new { isSuccess = true, gender.Id }));
                }
            }
            ViewBag.IsSuccess = false;
            ViewBag.id        = 0;

            return(View(gender));
        }
Beispiel #5
0
        public async Task <IActionResult> Create(Artist artist)
        {
            if (ModelState.IsValid)
            {
                ViewBag.Country = new SelectList(await GetCountry(), "Id", "Country_name");
                builder.Artist.Add(artist);
                builder.SaveChanges();
                int id = artist.Id;
                if (id > 0)
                {
                    return(RedirectToAction(nameof(Create), new { isSuccess = true, artist.Id }));
                }
            }
            ViewBag.IsSuccess = false;
            ViewBag.id        = 0;

            return(View(artist));
        }
Beispiel #6
0
        public async Task <IActionResult> Create(Album album)
        {
            if (ModelState.IsValid)
            {
                ViewBag.Artist = new SelectList(await GetArtist(), "Id", "Artistic_name");
                builder.Album.Add(album);
                builder.SaveChanges();
                int id = album.Id;
                if (id > 0)
                {
                    return(RedirectToAction(nameof(Create), new { isSuccess = true, album.Id }));
                }
            }
            ViewBag.IsSuccess = false;
            ViewBag.id        = 0;

            return(View(album));
        }
Beispiel #7
0
        public IActionResult Create(Country country)
        {
            if (ModelState.IsValid)
            {
                builder.Country.Add(country);
                builder.SaveChanges();
                int id = country.Id;
                if (id > 0)
                {
                    return(RedirectToAction(nameof(Create), new { isSuccess = true, country.Id }));
                }
            }
            ViewBag.IsSuccess = false;
            ViewBag.id        = 0;


            return(View(country));
        }
Beispiel #8
0
        public async Task <IActionResult> Create(Song song)
        {
            if (ModelState.IsValid)
            {
                ViewBag.Gender   = new SelectList(await GetGender(), "Id", "Gender_name");
                ViewBag.Language = new SelectList(await GetLanguage(), "Id", "Language_name");
                ViewBag.Country  = new SelectList(await GetCountry(), "Id", "Country_name");
                ViewBag.Album    = new SelectList(await GetAlbum(), "Id", "Album_name");
                ViewBag.Artist   = new SelectList(await GetArtist(), "Id", "Artistic_name");
                builder.Song.Add(song);
                builder.SaveChanges();
                int id = song.Id;
                if (id > 0)
                {
                    return(RedirectToAction(nameof(Create), new { isSuccess = true, song.Id }));
                }
            }
            ViewBag.IsSuccess = false;
            ViewBag.id        = 0;

            return(View(song));
        }