public CreateInvoiceViewModel(string quoteId, string nextInvoice) { QuoteId = quoteId; Quote quote = Quote.GetQuote(quoteId); WorkLocation location = WorkLocation.GetLocation(quote.WorkLocationId); Contact contact = Contact.GetContact(quote.ContactId); var acceptedWorks = AcceptedWork.GetWorksForQuote(quoteId); InvoiceId = quote.GetCustomerIdentifier() + "-" + nextInvoice; Date = DateTime.Today.ToString("dd-MM-yyyy"); InvoiceTo = location.WorkLocationName; InvoiceToAddress = location.GetAddress(); ContactId = quote.ContactId; WorkLocationId = quote.WorkLocationId; CareOf = contact.GetName(); CareOfEmail = contact.Email; CareOfNumber = contact.MobileNumber ?? contact.PhoneNumber; InvoiceDetails = new List <InvoiceDetail>() { new InvoiceDetail() { Description = "Refurbishment to squash courts as agrred", Price = acceptedWorks.Sum(work => work.Price) } }; }
public ContactDetails(Contact contact, WorkLocation location) { ClubName = location.WorkLocationName; ClubAddress = location.GetAddress(); ContactName = contact.FirstName + " " + contact.LastName; ContactNumber = contact.MobileNumber ?? contact.PhoneNumber; ContactEmail = contact.Email; }