public async Task <IActionResult> Form(int?id) { var genres = await _base_repository_genre.GetAll(); ViewBag.GenreList = genres.OrderBy(x => x.Name).Select( t => new SelectListItem { Value = t.Id.ToString(), Text = t.Name + (t.Active ? "" : " - Inactive") }); if (id != null) { var model = await _base_repository.GetById(id ?? 0); if (model != null) { ViewBag.Title = "Edit movie"; return(View(model)); } } ViewBag.Title = "Create movie"; return(View()); }
public async Task <IActionResult> Form(int?id) { if (id != null) { var model = await _base_repository.GetById(id ?? 0); if (model != null) { ViewBag.Title = "Edit genre"; return(View(model)); } } ViewBag.Title = "Create genre"; return(View()); }
public async Task <ActionResult <Event> > Get(int id) { try { var result = await _eventRepository.GetById(id); if (result != null) { return(result); } return(NotFound()); } catch (Exception ex) { _logger.LogError(ex, $"{LocalLog}[Get]"); throw ex; } }
public async Task <IActionResult> Delete(int id) { var item = await _base_repository_rental.GetById(id); if (item != null) { await _base_repository_rental.Remove(item); return(NoContent()); } return(NoContent()); }