public ViewResult Edit(int cityId) { ViewData["CountriesList"] = GetCountriesList(); City city = GetHelper <City> .GetById(Globals.CITIES_API_LINK, cityId); return(View("Edit", city)); }
public ViewResult Edit(int subjectId) { ViewData["TeacherList"] = GetTeachersList(); Subject subject = GetHelper <Subject> .GetById(Globals.SUBJECTS_API_LINK, subjectId); return(View("EditSubject", subject)); }
public ViewResult Edit(int attractionId) { ViewData["CitiesList"] = GetCityList(); Attraction attraction = GetHelper <Attraction> .GetById(Globals.ATTRACTION_API_LINK, attractionId); return(View("Edit", attraction)); }
public ActionResult EditAttraction(Attraction attraction) { City city = GetHelper <City> .GetById(Globals.CITIES_API_LINK, attraction.city.id); Country country = GetHelper <Country> .GetById(Globals.COUNTRIES_API_LINK, city.country.id); Attraction updatedAttraction = new Attraction() { id = attraction.id, name = attraction.name, address = attraction.address, type = attraction.type, city = new City { id = city.id, name = city.name, country = new Country { id = country.id, name = country.name } } }; UpdateHelper <Attraction> .UpdateEntity(Globals.ATTRACTION_API_LINK, updatedAttraction); return(RedirectToAction("Index")); }
public ActionResult EditSubject(Subject subject) { Teacher teacher = GetHelper <Teacher> .GetById(Globals.TEACHERS_API_LINK, subject.teacher.id); subject.teacher = teacher; UpdateHelper <Subject> .UpdateEntity(Globals.SUBJECTS_API_LINK, subject); return(RedirectToAction("Index")); }
public ActionResult EditClass(Class @class) { Class oldClass = GetHelper <Class> .GetById(Globals.CLASSES_API_LINK, @class.id); var oldName = oldClass.name; oldClass.name = @class.name; UpdateHelper <Class> .UpdateEntity(Globals.CLASSES_API_LINK, oldClass); TempData["message"] = "Pomyślnie dokonano edycji klasy " + oldName + " o id: " + @class.id; return(RedirectToAction("Index")); }
public ActionResult RemoveStudentFromClass(int classId, int studentId) { GetHelper <Class> .Remove(Globals.CLASSES_REMOVE_API_LINK, classId, studentId); var className = GetHelper <Class> .GetById(Globals.CLASSES_API_LINK, classId).name; Student student = GetHelper <Student> .GetById(Globals.STUDENTS_API_LINK, studentId); var studentName = student.forename + " " + student.surname; TempData["message"] = "Pomyślnie usunięto studenta " + studentName + " z klasy " + className; return(RedirectToAction("Index")); }
public ActionResult DeleteClass(int classId) { Class @class = GetHelper <Class> .GetById(Globals.CLASSES_API_LINK, classId); foreach (Student student in @class.students) { GetHelper <Class> .Remove(Globals.CLASSES_REMOVE_API_LINK, classId, student.id); } DeleteHelper.DeleteEntity(Globals.CLASSES_API_LINK, classId); TempData["message"] = "Pomyślnie usunięto klasę " + @class.name + " o id: " + classId; return(RedirectToAction("Index")); }
public ActionResult AddStudentToClass(int classId, int studentId) { GetHelper <Class> .Add(Globals.CLASSES_ADD_API_LINK, classId, studentId); var className = GetHelper <Class> .GetById(Globals.CLASSES_API_LINK, classId).name; Student student = GetHelper <Student> .GetById(Globals.STUDENTS_API_LINK, studentId); var studentName = student.forename + " " + student.surname; TempData["message"] = "Pomyślnie dodano studenta " + studentName + " do klasy " + className; return(RedirectToAction("Index")); }
public ActionResult SelectAttractions(City city) { city = GetHelper <City> .GetById(Globals.CITIES_API_LINK, city.id); Location location = new Location() { Address = Request.Form["address"], Langtitude = float.Parse(Request.Form["lang"]), Longtitude = float.Parse(Request.Form["long"]) }; ViewData["Location"] = location; ViewData["AttractionList"] = GetAttractionList(city); return(View()); }
public ActionResult SelectCity(Country country) { country = GetHelper <Country> .GetById(Globals.COUNTRIES_API_LINK, country.id); Location location = new Location() { Address = Request.Form["address"], Langtitude = float.Parse(Request.Form["lang"]), Longtitude = float.Parse(Request.Form["long"]) }; ViewData["Location"] = location; ViewData["CityList"] = GetCityList(country); return(View()); }
public ActionResult AddCity(City city) { Country country = GetHelper <Country> .GetById(Globals.COUNTRIES_API_LINK, city.country.id); city.country = country; City newCity = new City { name = city.name, country = new Country { id = country.id, name = country.name } }; PostHelper <City> .PostEntity(Globals.CITIES_API_LINK, newCity); return(RedirectToAction("Index")); }
private List <Location> SetLocationList(string[] ids) { List <Location> locations = new List <Location>(); foreach (string id in ids) { Attraction attraction = GetHelper <Attraction> .GetById(Globals.ATTRACTION_API_LINK, int.Parse(id)); Location location = new Location(); location.Address = attraction.city.name + " " + attraction.address; DataTable locationDataTable = GetLatAndLongOfStreet(getRequestUrl(location.Address)); location.Longtitude = float.Parse(locationDataTable.Rows[0]["Longtitude"].ToString(), CultureInfo.InvariantCulture); location.Langtitude = float.Parse(locationDataTable.Rows[0]["Latitude"].ToString(), CultureInfo.InvariantCulture); locations.Add(location); } return(locations); }
public ActionResult EditCity(City city) { Country country = GetHelper <Country> .GetById(Globals.COUNTRIES_API_LINK, city.country.id); city.country = country; City updatedCity = new City { id = city.id, name = city.name, country = new Country { id = country.id, name = country.name } }; UpdateHelper <City> .UpdateEntity(Globals.CITIES_API_LINK, updatedCity); return(RedirectToAction("Index")); }
private void SetClassName(int classId) { ViewData["className"] = GetHelper <Class> .GetById(Globals.CLASSES_API_LINK, classId).name; }
public ActionResult ViewAttractions(int cityId) { City cityGet = GetHelper <City> .GetById(Globals.CITIES_API_LINK, cityId); return(View("ViewAttractions", cityGet.attractions)); }
public ViewResult Edit(int countryId) { Country country = GetHelper <Country> .GetById(Globals.COUNTRIES_API_LINK, countryId); return(View("Edit", country)); }
public ActionResult ViewCities(int countryId) { Country countryGet = GetHelper <Country> .GetById("countries", countryId); return(View("ViewCities", countryGet.cities)); }
public ViewResult Edit(int studentId) { Student student = GetHelper <Student> .GetById(Globals.STUDENTS_API_LINK, studentId); return(View("EditStudent", student)); }
public ViewResult Edit(int classId) { Class @class = GetHelper <Class> .GetById(Globals.CLASSES_API_LINK, classId); return(View("EditClass", @class)); }
public ViewResult Edit(int teacherId) { Teacher teacher = GetHelper <Teacher> .GetById(Globals.TEACHERS_API_LINK, teacherId); return(View("EditTeacher", teacher)); }