Exemple #1
0
 public void Delete(TransporterRoute entity)
 {
     try
     {
         entities.TransporterRoutes.Remove(entity);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #2
0
 public void Add(TransporterRoute entity)
 {
     try
     {
         entities.TransporterRoutes.Add(entity);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #3
0
 public void Attach(TransporterRoute entity)
 {
     try
     {
         entities.TransporterRoutes.Attach(entity);
         entities.Entry(entity).State = EntityState.Modified;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #4
0
        public void Save(TransporterRoute entity)
        {
            try
            {
                TransporterRoute transporterRoute = entities.TransporterRoutes
                                                    .Where(x => x.FarmID == entity.FarmID && x.TransporterID == entity.TransporterID && x.Origin == entity.Origin).FirstOrDefault();

                if (transporterRoute != null)
                {
                    entities.Entry(transporterRoute).State = EntityState.Modified;
                }
                else
                {
                    Add(entity);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }