public void SaveTracingDetail(FrayteShipmentDetailSave ship) { try { if (ship.FrayteShipmentTracingSave != null && ship.FrayteShipmentTracingSave.Count > 0) { ShipmentTracing stt; foreach (FrayteShipmentTracing ss in ship.FrayteShipmentTracingSave) { stt = new ShipmentTracing(); stt.Comment = ss.Comment; stt.CommentDate = ss.CommentDate; stt.ShipmentBagId = ss.ShipmentBagId; dbContext.ShipmentTracings.Add(stt); try { dbContext.SaveChanges(); } catch (DbEntityValidationException ex) { foreach (var entityValidationErrors in ex.EntityValidationErrors) { foreach (var validationError in entityValidationErrors.ValidationErrors) { string exception = "Property: " + validationError.PropertyName + " Error: " + validationError.ErrorMessage; } } } } } } catch (Exception ex) { } }
public IHttpActionResult SaveTracingDetail(FrayteShipmentDetailSave ship) { new TracingRepository().SaveTracingDetail(ship); return(Ok()); }