Esempio n. 1
0
        public async Task <IActionResult> Create(Genre g)
        {
            var createGenre = await _genre.AddAsync(g);

            if (createGenre)
            {
                return(RedirectToAction("Index"));
            }
            return(View());
        }
Esempio n. 2
0
        public async Task <IActionResult> AddGenre([FromBody] Genre genre)
        {
            var createGenre = await _genre.AddAsync(genre);

            if (createGenre)
            {
                return(Ok("Genre Created"));
            }
            else
            {
                return(BadRequest(new { message = "Unable to create Genre details" }));
            }
        }
Esempio n. 3
0
        public async Task <IActionResult> AddBook([FromBody] Genre genre)
        {
            var createBook = await _genre.AddAsync(genre);

            if (createBook)
            {
                return(Ok("Genre Created"));
            }
            else
            {
                return(BadRequest(new { message = "Genre details cannot be created" }));
            }
        }
Esempio n. 4
0
        public async Task <IActionResult> Create(Genre genre)
        {
            genre.CreatedBy = _userManager.GetUserName(User);

            var createGenre = await _genre.AddAsync(genre);

            if (createGenre)
            {
                Alert("Genre Created successfully!", NotificationType.success);
                return(RedirectToAction("Index"));
            }
            Alert("Genre not created successfully!", NotificationType.error);
            return(View());
        }
Esempio n. 5
0
        public async Task <IActionResult> Create(Genre g)
        {
            var createGenre = await _genre.AddAsync(g);

            if (createGenre)
            {
                Alert("Genre Created successfully.", NotificationType.success);
                return(RedirectToAction("Index"));
            }
            else
            {
                Alert("Genre not Created!", NotificationType.error);
            }
            return(View());
        }
Esempio n. 6
0
        public async Task <IActionResult> Create(Genre genre)
        {
            genre.CreatedBy   = _userManager.GetUserName(User);
            genre.DateCreated = DateTime.Now;
            var createGenre = await _genre.AddAsync(genre);

            if (createGenre)
            {
                Alert("Genre created successfully.", NotificationType.success);

                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                Alert("Genre not created.", NotificationType.success);
            }
            return(View());
        }