public IEnumerable <string> AcademicPrograms() { var repo = new NHGetAllRepository <AcademicProgram>(); var data = repo.GetAll(); return(data.Select(x => x.Name)); }
public IEnumerable <Volunteer> GetAll() { using (var repo = new NHGetAllRepository <Volunteer>()) { return(repo.GetAll().AsEnumerable()); } }
public void Delete(long[] ids) { using (var repo = new NHGetAllRepository <T>()) { repo.Delete(ids); } }
public void Update(T entity) { using (var repo = new NHGetAllRepository <T>()) { repo.Update(entity); } }
public T Get(long id) { using (var repo = new NHGetAllRepository <T>()) { return(repo.Get(id)); } }
public T Add(T entity) { using (var repo = new NHGetAllRepository <T>()) { return(repo.Add(entity)); } }
public IEnumerable <string> CityTypes() { var repo = new NHGetAllRepository <CityType>(); var data = repo.GetAll(); return(data.Select(x => x.Name)); }
public void Delete(long id) { using (var repo = new NHGetAllRepository <Attendee>()) { repo.Delete(id); } }
public IEnumerable <string> Volunteers() { var repo = new NHGetAllRepository <Volunteer>(); var data = repo.GetAll(); return(data.Select(x => x.FullName)); }
public ActionResult Edit(int id) { var attendee = new NHRepository <Attendee>().Get(id); if (attendee.Type == AttendeeType.Pupil) { List <School> schools; using (var repository = new NHGetAllRepository <School>()) { schools = repository.GetAll().ToList(); } ViewData["Schools"] = new SelectList(schools, "Id", "Name"); List <AcademicProgram> programs; using (var repository = new NHGetAllRepository <AcademicProgram>()) { programs = repository.GetAll().ToList(); } ViewData["Programs"] = new SelectList(programs, "Id", "Name"); var list = new AcademicProgram { Id = -1, Name = "не выбрано" }.AsEnumerable().Concat(programs).ToList(); ViewData["NullablePrograms"] = new SelectList(list, "Id", "Name"); var pupil = attendee as Pupil; return(View("EditPupil", pupil)); } return(View(attendee)); }
public IEnumerable <Department> GetAll() { using (var repo = new NHGetAllRepository <Department>()) { return(repo.GetAll().AsEnumerable()); } }
public ActionResult Add() { List <School> schools; using (var repository = new NHGetAllRepository <School>()) { schools = repository.GetAll().ToList(); } ViewData["Schools"] = new SelectList(schools, "Id", "Name"); List <AcademicProgram> programs; using (var repository = new NHGetAllRepository <AcademicProgram>()) { programs = repository.GetAll().ToList(); } ViewData["Programs"] = new SelectList(programs, "Id", "Name"); var list = new AcademicProgram { Id = -1, Name = "не выбрано" }.AsEnumerable().Concat(programs).ToList(); ViewData["NullablePrograms"] = new SelectList(list, "Id", "Name"); return(View()); }
public IEnumerable <Entity> GetAll() { using (var repo = new NHGetAllRepository <Entity>()) { return(repo.GetAll().AsEnumerable()); } }
public IEnumerable <Subject> GetAll() { using (var repo = new NHGetAllRepository <Subject>()) { return(repo.GetAll().AsEnumerable()); } }
public IEnumerable <AcademicProgram> GetAll() { using (var repo = new NHGetAllRepository <AcademicProgram>()) { return(repo.GetAll().AsEnumerable()); } }
public IEnumerable <string> Groups() { var repo = new NHGetAllRepository <School>(); var data = repo.GetAll(); return(data.Select(x => x.Name)); }
public IEnumerable <SchoolType> GetAll() { using (var repo = new NHGetAllRepository <SchoolType>()) { return(repo.GetAll().AsEnumerable()); } }
public IEnumerable <string> ContactPersons() { var repo = new NHGetAllRepository <ContactPerson>(); var data = repo.GetAll(); return(data.Select(x => x.ContactInfo.FullName)); }
public IEnumerable <string> Departments() { var repo = new NHGetAllRepository <Department>(); var data = repo.GetAll(); return(data.Select(x => x.Name)); }
public IEnumerable<Group> GetAll() { using (var repo = new NHGetAllRepository<Group>()) { return repo.GetAll().AsEnumerable(); } }
public ActionResult School(int id = 0) { ViewBag.Edit = id != 0; List <Address> addresses; using (var repository = new NHGetAllRepository <Address>()) { addresses = repository.GetAll().ToList(); } var listAddress = (IEnumerable <SelectListItem>) new SelectList(addresses, "Id", "FullAddress"); List <SchoolType> types; using (var repository = new NHGetAllRepository <SchoolType>()) { types = repository.GetAll().ToList(); } var listType = (IEnumerable <SelectListItem>) new SelectList(types, "Id", "Name"); SchoolDto school = new SchoolDto(); if (id != 0) { using (var repository = new NHRepository <School>()) { var t = repository.Get(id); school = new SchoolDto() { Id = t.Id, Address = t.Addresses.ToList()[0].Id, Name = t.Name, Type = t.Type.Id }; } listAddress = addresses.Select(x => new SelectListItem() { Text = x.FullAddress, Selected = x.Id == school.Address, Value = x.Id.ToString() }); listType = types.Select(x => new SelectListItem() { Text = x.Name, Selected = x.Id == school.Type, Value = x.Id.ToString() }); } ViewData["Address"] = listAddress; ViewData["Type"] = listType; return(View(school)); }
public IEnumerable <Address> Addresses(int?index) { var repo = new NHGetAllRepository <Address>(); var data = repo.GetAll(); var ids = new NHGetAllRepository <School>().GetAll().Where(x => x.Id != index).SelectMany(x => x.Addresses.Select(xx => xx.Id)); return(data.Where(x => !ids.Contains(x.Id))); }
public ActionResult EditPupil(Pupil pupil, int school, IEnumerable <int> intrestingPrograms, IEnumerable <int> registrarionPrograms, int enterProgram) { List <School> schools; using (var repository = new NHGetAllRepository <School>()) { schools = repository.GetAll().ToList(); } ViewData["Schools"] = new SelectList(schools, "Id", "Name"); List <AcademicProgram> programs; using (var repository = new NHGetAllRepository <AcademicProgram>()) { programs = repository.GetAll().ToList(); } ViewData["Programs"] = new SelectList(programs, "Id", "Name"); var list = new AcademicProgram { Id = -1, Name = "не выбрано" }.AsEnumerable().Concat(programs).ToList(); ViewData["NullablePrograms"] = new SelectList(list, "Id", "Name"); IsValid = true; if (pupil.ContactInfo.FullName.IsNullOrEmpty()) { AddModelError("FullName", "Введите ФИО"); } if (!pupil.ContactInfo.Email.IsCorrectEmail()) { AddModelError("Email", "Неверный формат Email"); } if (!pupil.ContactInfo.PhoneNumber.IsCorrectPhone()) { AddModelError("PhoneNumber", "Неверный формат номера"); } if (pupil.YearOfGraduation <= 2010 || pupil.YearOfGraduation >= 2030) { AddModelError("Year", "Неверный формат года"); } if (!IsValid) { return(View()); } new PupilRepository().Update(pupil, school, intrestingPrograms, registrarionPrograms, enterProgram); return(RedirectToAction("Index")); }
public ActionResult AddExecution() { using (var repository = new NHGetAllRepository <Address>()) { var list = repository.GetAll().ToList(); ViewData["Addresses"] = new SelectList(list, "Id", "FullAddress"); } return(PartialView()); }
public IEnumerable <SimpleEntity> GetSimple() { var repo = new NHGetAllRepository <AcademicProgram>(); var data = repo.GetAll(); return(data.Select(x => new SimpleEntity() { Id = x.Id, View = x.Name })); }
public IEnumerable <SimpleEntity> GetSimple() { var repo = new NHGetAllRepository <Address>(); var data = repo.GetAll(); return(data.ToList().Select(x => new SimpleEntity() { Id = x.Id, View = x.FullAddress })); }
public IEnumerable <SimpleEntity> GetSimple() { var repo = new NHGetAllRepository <Volunteer>(); var data = repo.GetAll(); return(data.Select(x => new SimpleEntity() { Id = x.Id, View = x.FullName })); }
public ActionResult Partail(string viewName, bool edit) { //ViewBag.Title = "mu"; var addresses = new NHGetAllRepository <Address>().GetAll().ToList(); ViewData["Address"] = new SelectList(addresses, "Id", "FullAddress"); ViewBag.Edit = edit; return(View(viewName)); }
public IEnumerable <Region> GetAll(RegionArgs args) { using (var repo = new NHGetAllRepository <Region>()) { var query = repo.GetAll(); if (args.Country.IsNotEmpty()) { query = query.Where(x => x.Country.Name == args.Country); } return(query.AsEnumerable()); } }
static void Main(string[] args) { NHibernateHelper.Configure("Data Source=HALA\\SQLEXPRESS;Initial Catalog=HSEvents;Integrated Security=True;"); using (var session = NHibernateHelper.OpenSession()) { new AttendeesCreator().Run(session); } using (var repo = new NHGetAllRepository <EventExecution>()) { repo.Delete(x => x.Event == null); } }