private static void Map(AirWaybillEditData @from, AirWaybill to) { to.ArrivalAirport = @from.ArrivalAirport; to.Bill = @from.Bill; to.BrokerId = @from.BrokerId; to.SenderUserId = from.SenderUserId; to.DateOfArrival = @from.DateOfArrival; to.DateOfDeparture = @from.DateOfDeparture; to.DepartureAirport = @from.DepartureAirport; to.GTD = @from.GTD; to.AdditionalCost = @from.AdditionalCost; to.BrokerCost = @from.BrokerCost; to.CustomCost = @from.CustomCost; to.FlightCost = @from.FlightCost; to.TotalCostOfSenderForWeight = from.TotalCostOfSenderForWeight; }
public long Add(AirWaybillEditData data, long stateId, long creatorUserId) { var entity = new AirWaybill { CreationTimestamp = DateTimeProvider.Now, StateChangeTimestamp = DateTimeProvider.Now, StateId = stateId, IsActive = true, CreatorUserId = creatorUserId }; Map(data, entity); _context.AirWaybills.InsertOnSubmit(entity); _context.SaveChanges(); return(entity.Id); }