public void addResourceType(CarpoolingModel.Types.ResourceType resourceType)
 {
     try {
         db.ResourceTypes.InsertOnSubmit(RepositoryUtility.createDALResourceTyFromResourceTy(resourceType));
         db.SubmitChanges();
     } catch (Exception) {
         //TODO saznaj koje su iznimke
         //iznimka se generira ako se narusi bilo koje pravilo vezano uz primary key ili foreign key. Znači, iznimka se
         //generira ako se pokuša dodati osoba koja ima JMBAG koji koristi neka druga osoba, zatim ako se pod osoba.sifUloga
         //stavi neki broj kojeg nema u tablici Uloga, itd..
         //return false;
     }
     //return true;
 }
Пример #2
0
        public List<Route> getRoutesByType(CarpoolingModel.Types.RouteType type)
        {
            List<Route> listRt = new List<Route>();
            var routes = db.Routes.Where(s => s.routeType == type.Id);

            foreach (CarpoolingDAL.Route res in routes) {
                listRt.Add(getRouteById(res.idRoute));
            }
            return listRt;
        }
Пример #3
0
        public List<Group> getGroupsByType(CarpoolingModel.Types.GroupType groupType)
        {
            List<Group> listTyGr = new List<Group>();
            var groups = db.Groups.Where(s => s.groupType == groupType.Id);

            foreach (CarpoolingDAL.Group res in groups) {
                listTyGr.Add(RepositoryUtility.createGroupFromDALGroup(res as CarpoolingDAL.Group));
            }
            return listTyGr;
        }