Exemplo n.º 1
0
 public ActionResult DeleteRoute(long taskid)
 {
     try
     {
         var route = travelDb.Tasks.FirstOrDefault(t => t.TaskId == taskid);
         if (route != null)
         {
             travelDb.Remove(route);
             travelDb.SaveChanges();
         }
     }
     catch (Exception e)
     {
         return(BadRequest(e.InnerException.Message));
     }
     return(NoContent());
 }
 public ActionResult DeleteTravel(long travelid)
 {
     try
     {
         var travel = travelDb.Travels.FirstOrDefault(t => t.TravelId == travelid);
         if (travel != null)
         {
             travelDb.Remove(travel);
             travelDb.SaveChanges();
         }
     }
     catch (Exception e)
     {
         return(BadRequest(e.InnerException.Message));
     }
     return(NoContent());
 }
Exemplo n.º 3
0
 public ActionResult DeleteDiary(long diaryId)
 {
     try
     {
         var diary = travelDb.Diaries.FirstOrDefault(t => t.DiaryId == diaryId);
         if (diary != null)
         {
             travelDb.Remove(diary);
             travelDb.SaveChanges();
         }
     }
     catch (Exception e)
     {
         return(BadRequest(e.InnerException.Message));
     }
     return(NoContent());
 }
Exemplo n.º 4
0
 public ActionResult DeleteRoute(long[] routeids)
 {
     try
     {
         for (int i = 0; i < routeids.Length; i++)
         {
             var route = travelDb.Routes.FirstOrDefault(t => t.RouteId == routeids[i]);
             if (route != null)
             {
                 travelDb.Remove(route);
                 travelDb.SaveChanges();
             }
         }
     }
     catch (Exception e)
     {
         return(BadRequest(e.InnerException.Message));
     }
     return(NoContent());
 }