Beispiel #1
0
        // GET: WalksController/Delete/5
        public ActionResult Delete(int walkerId)
        {
            List <Walks>     walks = _walksRepo.GetWalksByWalkerId(walkerId);
            WalksDeleteModel wdm   = new WalksDeleteModel()
            {
                Walks = walks.Select(w => new SelectListItem
                {
                    Value = w.Id.ToString(),
                    Text  = $"{w.Date} {w.Dog.Name} {w.Duration / 60}"
                })
            };

            return(View(wdm));
        }
Beispiel #2
0
 public ActionResult Delete(WalksDeleteModel res)
 {
     try
     {
         int idToDelete;
         foreach (int id in res.SelectedWalks)
         {
             idToDelete = id;
             _walksRepo.DeleteWalks(idToDelete);
         }
         return(RedirectToAction("Index", "Walker"));
     }
     catch
     {
         return(View(res));
     }
 }