public IActionResult Create() { var mappedEmployees = EmployeeMapper.MapManyToViewModel(employeeService.GetEmployees()); var mappedOrders = OrderMapper.MapManyToViewModel(orderService.GetOrders()); return(View(new ProtocolCreateViewModel(mappedEmployees, mappedOrders))); }
public IActionResult Create() { var mappedClients = ClientMapper.MapManyToViewModel(clientService.GetClients()); var mappedOrders = OrderMapper.MapManyToViewModel(orderService.GetOrders()); return(View(new InvoiceCreateViewModel(mappedClients, mappedOrders))); }
public IActionResult Index(string filter) { var orders = OrderMapper.MapManyToViewModel(orderService.GetOrders()); if (string.IsNullOrEmpty(filter)) { return(View(orders)); } return(View(orders.Where(order => order.Title.Contains(filter)))); }
public IActionResult Details(int id) { if (id < 1) { return(NotFound()); } try { var employee = (employeeService.GetEmployeeById(id)); var protocols = new List <ProtocolViewModel>(); if (employee.Protocols != null && employee.Protocols.Any()) { protocols = ProtocolMapper.MapManyToViewModel(employee.Protocols).ToList(); } var orders = new List <OrderViewModel>(); if (employee.Orders != null && employee.Orders.Any()) { orders = OrderMapper.MapManyToViewModel(employee.Orders).ToList(); } var mappedEmployee = EmployeeMapper.MapToViewModel(employee, employee.EmployeesQualifications, protocols, orders); var result = new EmployeeDetailsViewModel(QualificationMapper.MapManyToViewModel(qualificationService.GetQualifications()).ToList()) { Employee = mappedEmployee, }; return(View(result)); } catch (Exception ex) { return(NotFound(ex)); } }
public IActionResult Details(int id) { if (id < 1) { return(BadRequest()); } try { var protocol = protocolService.GetProtocolById(id); var mappedProtocol = ProtocolMapper.MapToViewModel(protocol, EmployeeMapper.MapToViewModel(protocol.Employee), OrderMapper.MapToViewModel(protocol.Order)); var details = new ProtocolDetailsViewModel(EmployeeMapper.MapManyToViewModel(employeeService.GetEmployees()), OrderMapper.MapManyToViewModel(orderService.GetOrders()), mappedProtocol); return(View(details)); } catch (Exception ex) { return(NotFound(ex)); } }
public IActionResult Details(int id) { if (id < 1) { return(BadRequest()); } try { var clients = clientService.GetClients(); var orders = orderService.GetOrders(); var invoice = invoiceService.GetInvoiceById(id); var mappedInvoice = InvoiceMapper.MapToViewModel(invoice, invoice.Order, invoice.Client); var details = new InvoiceDetailsViewModel(ClientMapper.MapManyToViewModel(clients), OrderMapper.MapManyToViewModel(orders)); details.Invoice = mappedInvoice; return(View(details)); } catch (Exception ex) { return(NotFound(ex)); } }