public static DispatchNote Create(IRepositoryLocator locator, DispatchNoteModel model) { var haulier = locator.GetById <Haulier>(model.HaulierId); var instance = new DispatchNote { CreationDate = model.CreationDate, LastUpdate = model.CreationDate, DispatchDate = model.DispatchDate, DispatchNoteStatus = New, DispatchReference = model.DispatchReference, Haulier = haulier, TruckReg = model.TruckReg, User = model.User }; locator.Save(instance); model.Lines.ForEach(l => instance.AddLine(locator, l)); return(instance); }
public static TrackingNotification Create(IRepositoryLocator locator, TrackingNotificationDto dto, DispatchNote dispatchNote) { var instance = Mapper.Map <TrackingNotification>(dto); instance.DispatchNote = dispatchNote; return(locator.Save(instance)); }