/// <summary> /// Load detail order data from DB converting to List of IOrderViewModel by orderId /// Out errorMessage if data not loaded /// </summary> public bool SaveOrder(List <IOrderViewModel> orderCollection, string accessToken, out string errorMessage) { errorMessage = null; LaborDetail.Item result = new LaborDetail.Item(); var mainlabor = orderCollection.FirstOrDefault(x => x is BasicWorkViewModel); if (mainlabor != null) { mainlabor.ConvertToModel(result); var sublaborOrderCollection = orderCollection.ToList(); sublaborOrderCollection.Remove(mainlabor); foreach (var item in sublaborOrderCollection) { item.ConvertToModel(result); } } if (result.Identity > 0) { WebApiWorker.PutData(apiLaborDetail + "/LaborDetail/Put", result, null, out errorMessage); } else { WebApiWorker.PostData(apiLaborDetail + "/LaborDetail/Post", result, null, out errorMessage); } return(string.IsNullOrEmpty(errorMessage)); }
/// <summary> /// Change order status by orderId and statusId /// </summary> public bool ChangeOrderStatus(int LaborDetailID, int StatusID, string accessToken, out string errorMessage) { WebApiWorker.PostData(apiLaborDetail + "/LaborDetail/ChangeStatus", new { LaborDetailID, StatusID }, null, out errorMessage); return(string.IsNullOrEmpty(errorMessage)); }