public long PutArrivalSostav(long id, [FromBody] ArrivalSostav value) { try { this.ef_ids.Update(value); int res = this.ef_ids.Save(); return(res > 0 ? value.id : res); } catch (Exception e) { return(-1); } }
public void Test_MTContent_MTList() { ArrivalSostav aso = new ArrivalSostav(); MTContent mt = new MTContent(); foreach (Oracle_ArrivalSostav oas in aso.Get_ArrivalSostavNoClose().Where(a => a.ListWagons != null)) { Console.WriteLine("natur {0}, count = {1}", oas.NaturNum, mt.GetIDSostavToWagons(oas.ListWagons, oas.DateTime).Count()); } //string sw = "60662830;65383853;67660423;74021965;65046567;56560055;24534372;50546159;57517948;55977870;55763296;55320519;63627558;65206062;67751354;67794347;64083868;66522079;65009771;66495458;67288738;65125502;65710154;66399379;65469769;62823661;65438236;55063119;53777959;60832383;56765530;56138001;53436556;52749769;56936644;56969702;52876307;53551669;60091303;55119531;55118251;61246328;59717553;57411928;60267812;52965274;55139851;52733540;53569752;66680547;65483307;60261211;56982416;54122338;61243358;60806072;62034137;59785881;"; //Console.WriteLine("id sostav = {0}", mt.GetIDSostavToWagons(sw)); }
public IHttpActionResult GetCurrentNumArrivalSostavOfStation(int id) { try { ArrivalSostav sostav = this.ef_ids .Context .Where(s => s.id_station_on == id & s.date_arrival.Year == DateTime.Now.Year) .ToList() .OrderByDescending(n => n.num_doc).FirstOrDefault(); return(Ok(sostav != null ? sostav.num_doc : 0)); } catch (Exception e) { return(BadRequest(e.Message)); } }
public IHttpActionResult GetArrivalSostav(long id) { try { ArrivalSostav sostav = this.ef_ids .Context .Where(s => s.id == id) .ToList() .Select(c => c.GetArrivalSostav_ArrivalCars()).FirstOrDefault(); return(Ok(sostav)); } catch (Exception e) { return(BadRequest(e.Message)); } }
public static ArrivalSostav GetArrivalSostav(this ArrivalSostav s) { return(new ArrivalSostav() { id = s.id, id_arrived = s.id_arrived, file_name = s.file_name, composition_index = s.composition_index, date_time = s.date_time, operation = s.operation, create = s.create, close = s.close, arrived = s.arrived, Parent_id = s.Parent_id, ArrivalCars = s.ArrivalCars.ToList().Select(c => c.GetArrivalCars()).ToList(), }); }