public ActionResult Delete(DateTime from, DateTime to, int idCourt, FormCollection collection)
 {
     try
     {
         Advertisement ad   = SqlAdvertisement.GetAdvertisement(from, to, idCourt);
         User          user = SqlUser.GetUser(User.Identity.Name);
         if (user.RoleID == 1)
         {
             SqlAdvertisement.DeleteAdvertisement(ad, user.UserID);
         }
         else
         {
             if (ad.Payment == 0)
             {
                 SqlAdvertisement.DeleteAdvertisement(ad, user.UserID);
             }
             else
             {
                 return(RedirectToAction("ErrorDelete"));
             }
         }
         if (user.RoleID == 1)
         {
             return(RedirectToAction("Index"));
         }
         else
         {
             return(RedirectToAction("AdsForUsers"));
         }
     }
     catch
     {
         return(View());
     }
 }
        public ActionResult Edit(DateTime from, DateTime to, int idCourt)
        {
            User          user = SqlUser.GetUser(User.Identity.Name);
            Advertisement ad   = SqlAdvertisement.GetAdvertisement(from, to, idCourt);

            ViewBag.Role = user.RoleID;
            return(View(ad));
        }
        public ActionResult Delete(DateTime from, DateTime to, int idCourt)
        {
            Advertisement ad = SqlAdvertisement.GetAdvertisement(from, to, idCourt);

            return(View(ad));
        }