示例#1
0
        public async Task <IActionResult> Edit(Genre g)
        {
            var editGenre = await _genre.Update(g);

            if (editGenre && ModelState.IsValid)
            {
                return(RedirectToAction("Index"));
            }
            return(View());
        }
示例#2
0
        public async Task <IActionResult> Put(int id, [FromBody] Genre genre)
        {
            genre.Id = id;
            var updateGenre = await _genre.Update(genre);

            if (updateGenre)
            {
                return(Ok("Genre Updated"));
            }
            else
            {
                return(BadRequest(new { message = "Unable to update genre details" }));
            }
        }
示例#3
0
        public async Task <IActionResult> Edit(Genre g)
        {
            var editGenre = await _genre.Update(g);

            if (editGenre && ModelState.IsValid)
            {
                Alert("Genre Edited successfully.", NotificationType.success);
                return(RedirectToAction("Index"));
            }
            else
            {
                Alert("Genre not Edited!", NotificationType.error);
            }
            return(View());
        }
示例#4
0
        public async Task <IActionResult> Edit(Genre genre)
        {
            //var editAuthor = await _genre.GetById(id);
            var editGenre = await _genre.Update(genre);

            if (editGenre && ModelState.IsValid)
            {
                //    editAuthor.Name = author.Name;
                //    context.SaveChanges();
                Alert("Genre edited successfully!", NotificationType.success);
                return(RedirectToAction("Index"));
                //return RedirectToAction("Details", new { id = editAuthor.Id });
            }
            Alert("Genre not edited successfully!", NotificationType.error);
            return(View());
        }
示例#5
0
        public async Task <IActionResult> Edit(Genre genre)
        {
            //var editAuthor = await _author.GetById(id);
            var editGenre = await _genre.Update(genre);

            if (editGenre)
            {
                Alert("Genre created successfully", NotificationType.success);
                return(RedirectToAction("Index"));
            }
            else
            {
                Alert("Genre not created", NotificationType.error);
            }
            return(View());
        }