public ActionResult ViewInvoice() { //else //Redirect user. List <InvoicePO> mappedInvoice = new List <InvoicePO>(); try { List <InvoiceDO> allInvoices = new List <InvoiceDO>(); //if the user is an admin or super //View all invoices if (Session["RoleID"].Equals(1) || Session["RoleID"].Equals(2)) { allInvoices = _invoiceDataAccess.ViewInvoices(); } else { // client views only there invoices long userId = (long)Session["UserID"]; allInvoices = _invoiceDataAccess.ViewInvoiceByUserID(userId); } foreach (InvoiceDO dataObject in allInvoices) { mappedInvoice.Add(InvoiceMap1.InvoiceDOtoInvoicePO(dataObject)); } } catch (Exception ex) { logger.Log("Fatal", ex.Source, ex.TargetSite.ToString(), ex.Message, ex.StackTrace); } finally { } return(View(mappedInvoice)); }
public ActionResult UpdateInvoice(Int64 InvoiceID) { //defines the variables InvoiceDO item = _invoiceDataAccess.ViewInvoiceByID(InvoiceID); InvoicePO invoiceToUpdate = InvoiceMap1.InvoiceDOtoInvoicePO(item); return(View(invoiceToUpdate)); }