コード例 #1
0
        public void InsertOptimalRoute_Config(ConfigOptimalRoute configData)
        {
            EntitiesContext ec = new EntitiesContext();

            ec.OptimalRoute_Config.Add(configData);
            ec.SaveChanges();
        }
コード例 #2
0
        //for inserting distance from front-end json to database
        public void InsertDistanceInfo(List <Distance_Table> distance_info)
        {
            EntitiesContext ec = new EntitiesContext();

            ec.Distances.AddRange(distance_info);
            ec.SaveChanges();
        }
コード例 #3
0
        public void InsertCustomer(Customer customer)
        {
            EntitiesContext ec = new EntitiesContext();

            ec.Customers.Add(customer);
            ec.SaveChanges();
        }
コード例 #4
0
ファイル: Service.svc.cs プロジェクト: ishant3/SnelTransport
        public void DeleteCustomer(string id)
        {
            int             k  = Convert.ToInt32(id);
            EntitiesContext ec = new EntitiesContext();
            var             c  = (from cust in ec.Customers
                                  where cust.Id == k
                                  select cust).First();

            ec.Customers.Remove(c);
            ec.SaveChanges();
        }
コード例 #5
0
ファイル: Service.svc.cs プロジェクト: ishant3/SnelTransport
 //for inserting distance from front-end json to database
 public void InsertDistanceInfo(List <Distance_Table> distance_info)
 {
     if (distance_info.Count() != 0)
     {
         EntitiesContext ec = new EntitiesContext();
         ec.Distances.AddRange(distance_info);
         ec.SaveChanges();
     }
     else
     {
         MyCustomErrorDetail customError = new MyCustomErrorDetail("Distance list not found",
                                                                   "Please check whether the list is successfully send!");
         throw new WebFaultException <MyCustomErrorDetail>(customError, HttpStatusCode.NotFound);
     }
 }
コード例 #6
0
ファイル: Service.svc.cs プロジェクト: ishant3/SnelTransport
 public void InsertCustomer(Customer customer)
 {
     if (customer != null)
     {
         EntitiesContext ec = new EntitiesContext();
         ec.Customers.Add(customer);
         ec.SaveChanges();
     }
     else
     {
         MyCustomErrorDetail customError = new MyCustomErrorDetail("Correct customer details not found",
                                                                   "Please check all the customer fields entered are of correct type!");
         throw new WebFaultException <MyCustomErrorDetail>(customError, HttpStatusCode.NotFound);
     }
 }
コード例 #7
0
ファイル: Service.svc.cs プロジェクト: ishant3/SnelTransport
 public void InsertOptimalRoute_Config(ConfigOptimalRoute configData)
 {
     if (configData != null)
     {
         EntitiesContext ec = new EntitiesContext();
         ec.OptimalRoute_Config.Add(configData);
         ec.SaveChanges();
     }
     else
     {
         MyCustomErrorDetail customError = new MyCustomErrorDetail("Optimal Route Configuration not found",
                                                                   "Please check wheteher config properties with proper input type is provided!");
         throw new WebFaultException <MyCustomErrorDetail>(customError, HttpStatusCode.NotFound);
     }
 }
コード例 #8
0
        public void UpdateCustomer(Customer customer)
        {
            EntitiesContext ec = new EntitiesContext();
            var             c  = (from cust in ec.Customers
                                  where cust.Id == customer.Id
                                  select cust).First();

            c.Name        = customer.Name;
            c.PostCode    = customer.PostCode;
            c.HouseNumber = customer.HouseNumber;
            c.Street      = customer.Street;
            c.Telephone   = customer.Telephone;
            c.Fax         = customer.Fax;
            c.City        = customer.City;
            ec.SaveChanges();
        }
コード例 #9
0
ファイル: Service.svc.cs プロジェクト: ishant3/SnelTransport
 public void UpdateCustomer(Customer customer)
 {
     if (customer != null)
     {
         EntitiesContext ec = new EntitiesContext();
         var             c  = (from cust in ec.Customers
                               where cust.Id == customer.Id
                               select cust).First();
         c.Name        = customer.Name;
         c.PostCode    = customer.PostCode;
         c.HouseNumber = customer.HouseNumber;
         c.Street      = customer.Street;
         c.Telephone   = customer.Telephone;
         c.Fax         = customer.Fax;
         c.City        = customer.City;
         ec.SaveChanges();
     }
     else
     {
         MyCustomErrorDetail customError = new MyCustomErrorDetail("Correct customer details not provided",
                                                                   "Please check all the customer fields entered are of correct type!");
         throw new WebFaultException <MyCustomErrorDetail>(customError, HttpStatusCode.NotFound);
     }
 }