Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <% foreach (var item in Model.getDocument)
- { %>
- <tr>
- <td>
- <%:Html.DisplayFor(ModelState => item.DOCUMENT_NAME)%>
- </td>
- <td>
- <%:Html.DisplayFor(ModelState => item.ActiveDate)%>
- </td>
- <td>
- <%:Html.DisplayFor(ModelState => item.Revision)%>
- </td>
- <td>
- </tr>
- <% } %>
- var model = new GetDocumentParent
- {
- getDocument = db.Document.ToList(),
- getDocumentRevision = db.DocumentRevisions.ToList()
- };
- return View(model);
- public string DOCUMENT_NAME
- {
- get;
- set;
- }
- public Nullable<System.DateTime> ActiveDate
- {
- get;
- set;
- }
- }
- var model = new GetDocumentParent();
- model.getDocument = ...//Code that initialize getDocument
- model.getDocumentRevision =...//Code that initialize getDocumentRevision
- @Html.EditorFor(m=>m.getDocument);
- @Html.EditorFor(m=>m.getDocumentRevision);
- public class CustomerDetailsViewModel
- {
- public string FirstName { get; set; }
- public string Lastname { get; set; }
- public int Age { get; set; }
- public string AddressLine1 { get; set; }
- public string AddressLine2 { get; set; }
- public string City { get; set; }
- }
- public class CustomerController : Controller
- {
- private readonly ICustomerRepository customerRepository;
- public CustomerController(ICustomerRepository customerRepository)
- {
- // Check customerRepository for nulls
- this.customerRepository = customerRepository;
- }
- public ActionResult Details(int id)
- {
- // Check that id is not zero or negative
- Customer customer = customerRepository.GetById(id);
- // Get the customer's address
- Address address = customerRepository.GetCustomerAddress(id);
- CustomerDetailsViewModel viewModel = new CustomerDetailsViewModel()
- {
- FirstName = customer.Firstname,
- LastName = customer.LastName,
- Age = customer.Age,
- AddressLine1 = address.AddressLine1,
- AddressLine2 = address.AddressLine2,
- City = address.City
- }
- return View(viewModel);
- }
- }
- Customer customer = customerRepository.GetById(id);
- Address address = customerRepository.GetCustomerAddress(id);
- @model MyProject.DomainModel.ViewModels.Customers.CustomerDetailsViewModel
- <div class="content">
- <div class="display-label">First Name: </div>
- <div class="display-content">@Model.FirstName</div>
- <div class="display-label">Last Name: </div>
- <div class="display-content">@Model.LastName</div>
- <div class="display-label">Age: </div>
- <div class="display-content">@Model.Age</div>
- <div class="display-label">Address Line 1: </div>
- <div class="display-content">@Model.AddressLine1</div>
- <div class="display-label">Address Line 2: </div>
- <div class="display-content">@Model.AddressLine2</div>
- <div class="display-label">City: </div>
- <div class="display-content">@Model.City</div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement