public ActionResult Export(IEnumerable <OrderModel> orders) { var service = new BricklinkService(); var ordersWithShipping = orders .Where(x => x.Selected) .Select(x => service.GetOrderForCsv(x.OrderId.ToString())) .OrderBy(x => x.ShippingMethod) .ThenBy(x => x.Weight) .ThenBy(x => x.Name); var bytes = WriteCsvToMemory(ordersWithShipping); return(File(bytes, "text/csv", DateTime.Now.ToString("yyyy-MM-dd") + " Bricklink Export.csv")); }
public ActionResult GetOrderInfo(string orderId) { var order = _service.GetOrderForCsv(orderId); return(Json(order, JsonRequestBehavior.AllowGet)); }