public void Reject(int customerOrderID) { Stopwatch timespan = Stopwatch.StartNew(); try { CustomerOrder customerOrder = this.FindCustomerOrdersByID(customerOrderID); customerOrder.CustomerOrderStatusID = 3; customerOrder.RejectedDate = DateTime.Now; customerOrder.ApprovedDate = null; db.Entry(customerOrder).State = EntityState.Modified; db.SaveChangesAsync(); timespan.Stop(); log.TraceApi("SQL Database", "CustomerOrderRepository.Reject", timespan.Elapsed, "customerOrderID={0}", customerOrderID); } catch (Exception e) { log.Error(e, "Error in CustomerOrderRepository.Reject(customerOrderID={0})", customerOrderID); throw; } }
private bool HasCustomerOrder(int productQuoteID) { CustomerOrder customerOrder = db.CustomerOrders.Where(o => o.ProductQuoteID == productQuoteID).FirstOrDefault(); return(customerOrder != null); }