public HttpResponseMessage GetHistoryDetails(string historyId) { Guid historyIdguid = new Guid(historyId); var orderHistory = this.orderHistoryRepository.GetOrderHistoryByHistoryId(historyIdguid); if (orderHistory == null) { return(Request.CreateErrorResponse( HttpStatusCode.NotFound, string.Format(CultureInfo.CurrentCulture, Strings.OrderHistoryNotFoundById, historyId))); } var orderHistoryInfo = new OrderHistoryInfo(); Mapper.Map(orderHistory, orderHistoryInfo); return(Request.CreateResponse(HttpStatusCode.OK, orderHistoryInfo)); }
internal List <OrderHistoryInfo> GetOrdersHistory(int idReader) { DataTable table = dbWrapper.GetOrdersHistory(idReader); List <OrderHistoryInfo> OrdersHistory = new List <OrderHistoryInfo>(); int i = 0; foreach (DataRow row in table.Rows) { i++; OrderHistoryInfo order = new OrderHistoryInfo(); order.BookId = row["BookId"].ToString(); order.ExemplarId = (int)row["ExemplarId"]; order.FactReturnDate = (row["FactReturnDate"] == DBNull.Value) ? (DateTime)row["ReturnDate"] : (DateTime)row["FactReturnDate"]; order.OrderId = (int)row["ID"]; order.ReaderId = (int)row["ReaderId"]; order.ReturnDate = (DateTime)row["ReturnDate"]; order.StartDate = (DateTime)row["StartDate"]; order.IssueDate = (row["IssueDate"] == DBNull.Value) ? (DateTime)row["StartDate"] : (DateTime?)row["IssueDate"]; order.Book = ViewFactory.GetBookSimpleView(order.BookId); OrdersHistory.Add(order); } return(OrdersHistory); }