public GetAllOrdersByCustomerId ( string CustomerId ) : ICollection |
||
CustomerId | string | |
리턴 | ICollection |
public int GetLastOrderId() { // Add your operation implementation here var repo = new OrderRepository(); var customerRepo = new CustomerRepository(); var authCookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName]; if (authCookie == null) throw new Exception("Not logged in."); var authTicket = FormsAuthentication.Decrypt(authCookie.Value); var customerId = customerRepo.GetCustomerByUsername(authTicket.Name).CustomerId; var order = repo.GetAllOrdersByCustomerId(customerId).OrderByDescending(o => o.OrderId).First(); return order.OrderId; }