public ActionResult getUsers(int eventid) { var dataContext = new SqlConnectionDataContext(); List <String> users = SportEventModel.getUsersByEvent(dataContext, eventid); return(Json(users, JsonRequestBehavior.AllowGet)); }
public ActionResult SportEvent() { SportEventModel model = new SportEventModel(); SetEnumDDisciplineSelectList(false); return(View("SportEvent", model)); }
public ActionResult AddSportEvent(SportEventModel model) { if (SportEventRepository.AddSportEvent(model)) { ViewBag.SuccessMessages = "Wydarzenie zostało utworzone pomyślnie"; } else { ViewBag.ErrorMessages = SportEventRepository.ErrorList; } SportEventListViewModel viewModel = new SportEventListViewModel(); viewModel.SportEventList = SportEventRepository.GetAllSportEvents(); SetEnumDDisciplineSelectList(true); return(View("Index", viewModel)); }
public ActionResult EditEvent(int eventID) { if (ManageCookie.isAdmin() == false) { return(RedirectToAction("Index", "Home")); } ViewBag.Title = "Event Edit"; //check event exist if (!SportEventModel.isEventExists(eventID)) { return(RedirectToAction("Events")); } ViewBag.eventInfo = AdminModel.getEventInfo(eventID); ViewBag.eventAttenides = AdminModel.getEventAttendies(eventID); return(View()); }
public ActionResult PreviewSportEvent(int sportEventId) { int userIdFromContext = UserContextHelper.GetUserContextModel().ID; SportEventModel model = SportEventRepository.GetSportEventDetails(sportEventId); DateTime sportEventDateTime = DateTime.Parse(model.Date + " " + model.Time); var differenceHours = (sportEventDateTime - DateTime.Now).TotalHours; if (differenceHours < 1) { model.ContactList = SportEventRepository.GetContactDetailsForSportEvent(sportEventId, userIdFromContext); } model.IsCreateMode = false; SetEnumDDisciplineSelectList(false); TempData["IsUserParticipating"] = SportEventRepository.IsUserParticipatingInSportEvent(userIdFromContext, sportEventId); return(View("SportEvent", model)); }
public static bool AddSportEvent(SportEventModel sportEvent) { ErrorList = new List <string>(); bool result = false; if (sportEvent != null) { string sqlAddSportEvent = "INSERT INTO [FitbourhoodDB].[dbo].[SportEvents] (CreatorID, DDisciplineID, Date, Time, MaxCapacity, Address, CoordinateLatitude, CoordinateLongitude, Description, HasEnded) Values (@CreatorID, @DDisciplineID, @Date, @Time, @MaxCapacity, @Address, @CoordinateLatitude, @CoordinateLongitude, @Description, @HasEnded); SELECT CAST(SCOPE_IDENTITY() as int)"; using (var connection = new SqlConnection(ConnectionString)) { connection.Open(); var insertedSportEventID = connection.Query <int>(sqlAddSportEvent, new { CreatorID = sportEvent.CreatorID, DDisciplineID = sportEvent.DDiscipline, Date = sportEvent.Date, Time = sportEvent.Time, MaxCapacity = sportEvent.MaxCapacity, Address = sportEvent.Address, CoordinateLatitude = sportEvent.CoordinateLatitude, CoordinateLongitude = sportEvent.CoordinateLongitude, Description = sportEvent.Description, HasEnded = sportEvent.HasEnded }).Single(); if (insertedSportEventID > 0) { result = AddUserToSportEvent(sportEvent.CreatorID, insertedSportEventID); } else { ErrorList.Add("Wystąpił błąd podczas tworzenia nowego wydarzenia. Spróbuj ponownie."); } } } return(result); }
public ActionResult DeleteEvent(int eventID) { SportEventModel.deleteEventLocal(eventID); return(RedirectToAction("Events")); }
public ActionResult getCategoriesName() { string[] categoriesName = SportEventModel.getCategoriesName(); return(Json(categoriesName, JsonRequestBehavior.AllowGet));; }
public ActionResult Join(int eventid) { string status = SportEventModel.Join(eventid); return(Json(status, JsonRequestBehavior.AllowGet)); }
public ActionResult getTopTenPlacesStatistics() { List <CategoryStatistics> seStatistics = SportEventModel.getTopTenPlacesStatistics(); return(Json(seStatistics, JsonRequestBehavior.AllowGet)); }
public ActionResult deleteEvent(int eventID) { bool result = SportEventModel.deleteEventLocal(eventID); return(Json(result)); }
public ActionResult createEvent(FormCollection sportEventModel) { SportEventModel.createEvent(sportEventModel); return(RedirectToAction("Index", "Home")); }
public ActionResult GetEvents(FilterModel filter) { List <SportEvent_Parsed> sportEvents = SportEventModel.GetEvents(filter); return(Json(sportEvents, JsonRequestBehavior.AllowGet)); }