public async Task <IActionResult> Create(Genre g) { var createGenre = await _genre.AddAsync(g); if (createGenre) { return(RedirectToAction("Index")); } return(View()); }
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" })); } }
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" })); } }
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()); }
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()); }
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()); }