Exemple #1
0
 public bool Delete(int ID)
 {
   using (CaronteContext caronteCtx = new CaronteContext())
   {
     caronteCtx.Viaggio.Remove(caronteCtx.Viaggio.Find(ID));
     caronteCtx.SaveChanges();
     return true;
   }
 }
Exemple #2
0
 public bool Delete(int ID)
 {
     using (CaronteContext caronteCtx = new CaronteContext())
     {
         caronteCtx.Spostamento.Remove(caronteCtx.Spostamento.Find(ID));
         caronteCtx.SaveChanges();
         return(true);
     }
 }
Exemple #3
0
 public SpostamentoDTO New(SpostamentoDTO DTO)
 {
     using (CaronteContext caronteCtx = new CaronteContext())
     {
         Spostamento tmp = DTO.ToEntity();
         caronteCtx.Spostamento.Add(tmp);
         caronteCtx.SaveChanges();
         return(this.Get(tmp.IDSpostamento));
     }
 }
Exemple #4
0
 public SpostamentoDTO Update(SpostamentoDTO DTO)
 {
     using (CaronteContext caronteCtx = new CaronteContext())
     {
         Spostamento tmpAna = caronteCtx.Spostamento.Find(DTO.IDSpostamento);
         DTO.ToEntity(tmpAna);
         caronteCtx.SaveChanges();
         return(this.Get(tmpAna.IDSpostamento));
     }
 }
Exemple #5
0
 public AnagraficaDTO Update(AnagraficaDTO DTO)
 {
     using (CaronteContext caronteCtx = new CaronteContext())
     {
         Anagrafica tmpAna = caronteCtx.Anagrafica.Find(DTO.IDAnagrafica);
         DTO.ToEntity(tmpAna);
         caronteCtx.SaveChanges();
         return(this.Get(tmpAna.IDAnagrafica));
     }
 }
Exemple #6
0
 public AnagraficaDTO New(AnagraficaDTO DTO)
 {
     using (CaronteContext caronteCtx = new CaronteContext())
     {
         Anagrafica tmp = DTO.ToEntity();
         caronteCtx.Anagrafica.Add(tmp);
         caronteCtx.SaveChanges();
         return(this.Get(tmp.IDAnagrafica));
     }
 }
Exemple #7
0
 public ViaggioDTO New(ViaggioDTO DTO)
 {
   using (CaronteContext caronteCtx = new CaronteContext())
   {
     Viaggio tmp = DTO.ToEntity();
     caronteCtx.Viaggio.Add(tmp);
     caronteCtx.SaveChanges();
     return this.Get(tmp.IDViaggio);
   }
 }
Exemple #8
0
 public ViaggioDTO Update(ViaggioDTO DTO)
 {
   using (CaronteContext caronteCtx = new CaronteContext())
   {
     Viaggio tmpAna = caronteCtx.Viaggio.Find(DTO.IDViaggio);
     DTO.ToEntity(tmpAna);
     caronteCtx.SaveChanges();
     return this.Get(tmpAna.IDViaggio);
   }
 }
Exemple #9
0
 public VeicoloDTO Update(VeicoloDTO DTO)
 {
     using (CaronteContext caronteCtx = new CaronteContext())
     {
         Veicolo tmpAna = caronteCtx.Veicolo.Find(DTO.IDVeicolo);
         DTO.ToEntity(tmpAna);
         caronteCtx.SaveChanges();
         return(this.Get(tmpAna.IDVeicolo));
     }
 }
Exemple #10
0
 public VeicoloDTO New(VeicoloDTO DTO)
 {
     using (CaronteContext caronteCtx = new CaronteContext())
     {
         Veicolo tmp = DTO.ToEntity();
         caronteCtx.Veicolo.Add(tmp);
         caronteCtx.SaveChanges();
         return(this.Get(tmp.IDVeicolo));
     }
 }
Exemple #11
0
 public PosizioneDTO New(PosizioneDTO DTO)
 {
     using (CaronteContext caronteCtx = new CaronteContext())
     {
         Posizione tmp = DTO.ToEntity();
         caronteCtx.Posizione.Add(tmp);
         caronteCtx.SaveChanges();
         return(this.Get(tmp.IDPosizione));
     }
 }
Exemple #12
0
 public PosizioneDTO Update(PosizioneDTO DTO)
 {
     using (CaronteContext caronteCtx = new CaronteContext())
     {
         Posizione tmpAna = caronteCtx.Posizione.Find(DTO.IDPosizione);
         DTO.ToEntity(tmpAna);
         caronteCtx.SaveChanges();
         return(this.Get(tmpAna.IDPosizione));
     }
 }
Exemple #13
0
        public bool Delete(int ID)
        {
            using (CaronteContext caronteCtx = new CaronteContext())
            {
                caronteCtx.Dipendente.Remove(caronteCtx.Dipendente.Find(ID));
                AuthRepository ar = new AuthRepository();

                caronteCtx.SaveChanges();
                return(true);
            }
        }
Exemple #14
0
        public DipendenteDTO New(DipendenteDTO DTO)
        {
            using (CaronteContext caronteCtx = new CaronteContext())
            {
                Dipendente tmp = DTO.ToEntity();
                caronteCtx.Dipendente.Add(tmp);
                caronteCtx.SaveChanges();

                if (tmp.IDDipendente > 0)
                {
                    AuthRepository ar = new AuthRepository();
                    ar.RegisterUser(tmp);
                }

                return(this.Get(tmp.IDDipendente));
            }
        }
Exemple #15
0
 public DipendenteDTO Update(DipendenteDTO DTO)
 {
     using (CaronteContext caronteCtx = new CaronteContext())
     {
         Dipendente tmpAna = caronteCtx.Dipendente.Find(DTO.IDDipendente);
         DTO.ToEntity(tmpAna);
         caronteCtx.SaveChanges();
         AuthRepository ar = new AuthRepository();
         if (ar.FindUser(DTO.Username, DTO.Password) != null)
         {
             ar.UpdateUser(tmpAna);
         }
         else
         {
             ar.RegisterUser(tmpAna);
         }
         return(this.Get(tmpAna.IDDipendente));
     }
 }