public IHttpActionResult GetLogedCustomer() { string customerId = this.User.Identity.GetUserId(); Customer customer = this.EscortServiceData.Customers .FirstOrDefault(c => !c.IsDeleted && c.Id == customerId); if (customer == null) { return(this.Content(HttpStatusCode.NotFound, string.Format("There is no such active customer with Id: {0}!", customerId))); } var appointmentsMade = this.EscortServiceData.Appointments .Where(a => a.CustomerId == customerId).ToList(); var reviewsPosted = this.EscortServiceData.Reviews .Where(a => a.AuthorId == customerId).ToList(); DetailedCustomerViewModel result = new DetailedCustomerViewModel(customer, appointmentsMade, reviewsPosted); return(this.Ok(result)); }
public IHttpActionResult GetLogedCustomer() { string customerId = this.User.Identity.GetUserId(); Customer customer = this.EscortServiceData.Customers .FirstOrDefault(c => !c.IsDeleted && c.Id == customerId); if (customer == null) { return this.Content(HttpStatusCode.NotFound, string.Format("There is no such active customer with Id: {0}!", customerId)); } var appointmentsMade = this.EscortServiceData.Appointments .Where(a => a.CustomerId == customerId).ToList(); var reviewsPosted = this.EscortServiceData.Reviews .Where(a => a.AuthorId == customerId).ToList(); DetailedCustomerViewModel result = new DetailedCustomerViewModel(customer, appointmentsMade, reviewsPosted); return this.Ok(result); }