Beispiel #1
0
        public ActionResult UpdateSailboat(BoatPO form)
        {
            ActionResult oresponse = null;

            try
            {
                if (ModelState.IsValid)
                {
                    BoatDO dataObject = BoatMap1.BoatPOtoDO(form);
                    _boatDataAccess.UpdateSailboats(dataObject);
                    oresponse = RedirectToAction("ViewSailboats", "Boat");
                }
                else
                {
                    oresponse = View(form);
                }
            }
            catch (Exception ex)
            {
                logger.Log("Fatal", ex.Source, ex.TargetSite.ToString(), ex.Message, ex.StackTrace);
            }
            finally { }

            return(oresponse);
        }
Beispiel #2
0
        public ActionResult UpdateSailboat(Int64 BoatID)
        {
            BoatDO item         = _boatDataAccess.ViewBoatByID(BoatID);
            BoatPO boatToUpdate = BoatMap1.BoatDOtoBoatPO(item);

            return(View(boatToUpdate));
        }
        //Home Page
        public ActionResult Index()
        {
            ActionResult oResponse = null;

            //Give the list to the view to display
            try
            {
                List <InvoiceDO> allInvoices    = _invoiceDataAccess.ViewInvoices();
                List <InvoiceBO> mappedInvoices = new List <InvoiceBO>();
                foreach (InvoiceDO dataObject in allInvoices)
                {
                    mappedInvoices.Add(HighestProfitMap.InvoiceDOtoInvoiceBO(dataObject));
                }
                List <KeyValuePair <BoatPO, int> > topDisplay = new List <KeyValuePair <BoatPO, int> >();
                List <KeyValuePair <Int64, int> >  topBoats   = InvoiceBLO.TopBoatsByInvoiceCount(mappedInvoices);
                foreach (KeyValuePair <Int64, int> record in topBoats)
                {
                    BoatDO dataObject = _boatDataAccess.ViewBoatByID(record.Key);
                    BoatPO boat       = BoatMap1.BoatDOtoBoatPO(dataObject);
                    topDisplay.Add(new KeyValuePair <BoatPO, int>(boat, record.Value));
                }
                oResponse = View(topDisplay);
            }
            catch (Exception ex)
            {
                logger.Log("Fatal", ex.Source, ex.TargetSite.ToString(), ex.Message, ex.StackTrace);
            }
            finally
            {
            }
            return(oResponse);
        }
Beispiel #4
0
        public ActionResult ViewSailboats()
        {
            List <BoatDO> allSailboats = _boatDataAccess.ViewSailboats();

            List <BoatPO> mappedBoats = new List <BoatPO>();

            try
            {
                foreach (BoatDO dataObject in allSailboats)
                {
                    mappedBoats.Add(BoatMap1.BoatDOtoBoatPO(dataObject));
                }
            }
            catch (Exception ex)
            {
                logger.Log("Fatal", ex.Source, ex.TargetSite.ToString(), ex.Message, ex.StackTrace);
            }
            finally { }

            return(View(mappedBoats));
        }