public IHttpActionResult Get(string CustomerID, string CustomerTypeID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    CustomercustomerdemoBusinessModelLayers customercustomerdemoBusinessModelLayers = new CustomercustomerdemoBusinessModelLayers();

                    BusinessModelLayer.CustomercustomerdemoSingle customercustomerdemos = new CustomercustomerdemoSingle();

                    if (CustomerTypeID == null)
                    {
                        customercustomerdemos = customercustomerdemoBusinessModelLayers.GetAllCustomercustomerdemos().FirstOrDefault(x => x.CustomerID == CustomerID);
                    }
                    else
                    {
                        customercustomerdemos = customercustomerdemoBusinessModelLayers.GetAllCustomercustomerdemos().FirstOrDefault(x => x.CustomerID == CustomerID && x.CustomerTypeID == CustomerTypeID);
                    }

                    return(Ok(customercustomerdemos));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 2
0
        public ActionResult Edit_Post(string CustomerID, string CustomerTypeID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    CustomercustomerdemoBusinessModelLayers customercustomerdemoBusinessModelLayers = new CustomercustomerdemoBusinessModelLayers();

                    BusinessModelLayer.CustomercustomerdemoSingle customercustomerdemo;
                    if (CustomerTypeID == null)
                    {
                        customercustomerdemo = customercustomerdemoBusinessModelLayers.GetAllCustomercustomerdemos().Single(x => x.CustomerID == CustomerID);
                    }
                    else
                    {
                        customercustomerdemo = customercustomerdemoBusinessModelLayers.GetAllCustomercustomerdemos().Single(x => x.CustomerID == CustomerID && x.CustomerTypeID == CustomerTypeID);
                    }


                    UpdateModel <CustomercustomerdemoSingle>(customercustomerdemo);
                    if (ModelState.IsValid)
                    {
                        //mm
                        customercustomerdemoBusinessModelLayers.UpdateCustomercustomerdemo(customercustomerdemo);
                        return(RedirectToAction("List"));
                    }

                    return(View(customercustomerdemo));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 3
0
        public ActionResult Edit(string CustomerID, string CustomerTypeID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    CustomersBusinessModelLayers customersLUBusinessModelLayers = new CustomersBusinessModelLayers();
                    ViewBag.Customerss = new SelectList(customersLUBusinessModelLayers.CustomersSelect, "CustomerID", "CompanyName");
                    CustomerdemographicsBusinessModelLayers customerdemographicsLUBusinessModelLayers = new CustomerdemographicsBusinessModelLayers();
                    ViewBag.CustomerDemographicss = new SelectList(customerdemographicsLUBusinessModelLayers.CustomerdemographicsSelect, "CustomerTypeID", "CustomerDesc");

                    CustomercustomerdemoBusinessModelLayers customercustomerdemoBusinessModelLayers = new CustomercustomerdemoBusinessModelLayers();

                    BusinessModelLayer.CustomercustomerdemoSingle customercustomerdemo;
                    if (CustomerTypeID == null)
                    {
                        customercustomerdemo = customercustomerdemoBusinessModelLayers.GetAllCustomercustomerdemos().FirstOrDefault(x => x.CustomerID == CustomerID);
                    }
                    else
                    {
                        customercustomerdemo = customercustomerdemoBusinessModelLayers.GetAllCustomercustomerdemos().FirstOrDefault(x => x.CustomerID == CustomerID && x.CustomerTypeID == CustomerTypeID);
                    }

                    return(View(customercustomerdemo));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public IHttpActionResult Get(string CustomerID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    CustomercustomerdemoBusinessModelLayers customercustomerdemoBusinessModelLayers = new CustomercustomerdemoBusinessModelLayers();
                    List <BusinessModelLayer.CustomercustomerdemoSingle> customercustomerdemos      = customercustomerdemoBusinessModelLayers.GetAllCustomercustomerdemos().FindAll(x => x.CustomerID == CustomerID);

                    //BusinessModelLayer.CustomercustomerdemoSingle customercustomerdemos = customercustomerdemoBusinessModelLayers.GetCustomercustomerdemoData(CustomerID);
                    return(Ok(customercustomerdemos));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }