public IActionResult Create([Bind] SingerDetailEditViewModel model) { if (ModelState.IsValid) { var singer = model.ToSinger(); _singerMapper.Create(singer); return(RedirectToAction(nameof(Admin))); } return(View(model)); }
public IActionResult Edit(int id, [Bind] SingerDetailEditViewModel model) { if (id != model.Id) { return(NotFound()); } if (ModelState.IsValid) { var singer = model.ToSinger(); _singerMapper.Update(singer); return(RedirectToAction(nameof(Admin))); } return(View(model)); }
public IActionResult AdminDetails(int?id) { if (id == null) { return(NotFound()); } var singer = _singerMapper.Find(id.Value); if (singer == null) { return(NotFound()); } var model = new SingerDetailEditViewModel(singer); return(View(model)); }