public void removeResource(Resource resource) {
            try {
                CarpoolingDAL.Resource rs = db.Resources.Single(o => o.idResource == resource.Id);
                rs.active = false;
                db.SubmitChanges();
            } catch (Exception) {
                //return false;
            }

            //return true;
        }
 public void addResource(Resource resource, Client client)
 {
     try {
         db.Resources.InsertOnSubmit(RepositoryUtility.createDALResourceFromResource(resource, client));
         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;
 }
        public void updateResource(Resource resource) {
            try {
                CarpoolingDAL.Resource oldOne = db.Resources.Single(o => o.idResource == resource.Id);
                oldOne.age = resource.Age;
                oldOne.consumption = resource.Consumption;
                oldOne.name = resource.Name;
                oldOne.resourceType = resource.Type.Id;
                oldOne.seatNumber = resource.SeatNumber;
                db.SubmitChanges();
            } catch (Exception) {
                //return false;
            }

            //return true;
        }
        public void updateResource(Resource resource)
        {
            try {
                CarpoolingDAL.Resource oldOne = db.Resources.Single(o => o.idResource == resource.Id);
                oldOne.age = resource.Age;
                oldOne.consumption = resource.Consumption;
                oldOne.name = resource.Name;
                oldOne.resourceType = resource.Type.Id;
                oldOne.seatNumber = resource.SeatNumber;
                db.SubmitChanges();
            } catch (Exception) {
                //return false;
            }

            //return true;
        }
        public void removeResource(Resource resource)
        {
            try {
                CarpoolingDAL.Resource rs = db.Resources.Single(o => o.idResource == resource.Id);
                rs.active = false;
                db.SubmitChanges();
            } catch (Exception) {
                //return false;
            }

            //return true;
        }
		private void detach_Resources(Resource entity)
		{
			this.SendPropertyChanging();
			entity.Client = null;
		}
		private void attach_Resources(Resource entity)
		{
			this.SendPropertyChanging();
			entity.Client = this;
		}
 partial void DeleteResource(Resource instance);
 partial void UpdateResource(Resource instance);
 partial void InsertResource(Resource instance);
 public bool existResource(int idResource) {
     CarpoolingDAL.Resource oldOne = db.Resources.Single(o => o.idResource == idResource);
     if (oldOne != null) return true;
     else return false;
 }