public IHttpActionResult ListCustomers(Models.ListModel lm)
 {
     try
     {
         if (lm.control)
         {
             var a = db.Customer.Select(x => new Models.Customer()
             {
                 BirthDate    = x.BirthDate.ToString(),
                 CustomerID   = x.CustomerID,
                 Email        = x.Email,
                 Gender       = x.Gender,
                 Name         = x.Name,
                 PhoneNumber  = x.PhoneNumber,
                 Surname      = x.Surname,
                 UserName     = x.UserName,
                 UserPassword = x.UserPassword
             }).ToList();
             return(Ok(a));
         }
         return(NotFound());
     }
     catch (Exception e)
     {
         throw new Exception(e.ToString());
     }
 }
        public ActionResult CompanyData()
        {
            List<Model.RegionBase> reglist = regbll.GetModelList(" reg_PId=0");
            var models = new Models.ListModel();

            models.regList = reglist;
            Model.MemberInfo model = null;
            if (Request.Cookies["UserInfo"] != null)
            {
                model = new BLL.MemberBase().getMemberInfo((CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID);
                var tjlist = _productRecommendDetail.GetTop4List(" order by prt_id desc");
                models.dt = tjlist;
                models.Minfo = model;
                ViewData["proviceid"] = model.m_Provice;
                if (model.m_Provice != null)
                {
                    ViewData["provicename"] = regbll.GetModelByCode((int)model.m_Provice).reg_Name;
                }
                else
                    ViewData["provicename"] = "选择省";
                ViewData["cityid"] = model.m_City;
                if (model.m_City != null)
                {
                    ViewData["cityname"] = regbll.GetModelByCode((int)model.m_City).reg_Name;
                }
                else
                    ViewData["cityname"] = "选择市";
                ViewData["xianid"] = model.m_Count;
                if (model.m_Count != null)
                {
                    ViewData["xianname"] = regbll.GetModelByCode((int)model.m_Count).reg_Name;
                }
                else
                    ViewData["xianname"] = "选择区/县";
            }
            else
            {
                Response.Redirect("/logon/logon");
            }
            return View(models);
        }
 public IHttpActionResult ListCategories(Models.ListModel lm)
 {
     try
     {
         if (lm.control)
         {
             List <Models.Category> cList = db.Category.Where(x => x.Active == true).Select(x => new Models.Category()
             {
                 Active       = x.Active,
                 CategoryID   = x.CategoryID,
                 CategoryName = x.CategoryName
             }).ToList();
             return(Ok(cList));
         }
         return(null);
     }
     catch (Exception e)
     {
         throw new Exception(e.ToString());
     }
 }
        //
        // GET: /UserInfo/
        public ActionResult Index()
        {
            Model.MemberInfo model = null;
            if (Request.Cookies["UserInfo"] != null)
            {
                model = new BLL.MemberBase().getMemberInfo((CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID);
                var tjlist = _productRecommendDetail.GetTop4List(" order by prt_id desc");
                var models = new Models.ListModel();
                models.dt = tjlist;
                models.Minfo = model;

                try
                {
                    ViewBag.dengji = _newsBase.GetModelList(" n_Title='等级特权'  and n_StatusCode=0 and n_IsDel=0")[0].n_Content;
                }
                catch
                {
                    ViewBag.dengji = "暂无等级特权";
                }
                try
                {
                    ViewBag.shengji = _newsBase.GetModelList(" n_Title='升级机制'  and n_StatusCode=0 and n_IsDel=0")[0].n_Content;
                }
                catch
                {
                    ViewBag.shengji = "暂无升级机制";
                }

                return View(models);
            }
            else
            {
                Response.Redirect("/Index/Index");
                return View();
            }
        }
Exemple #5
0
 static ProductController()
 {
     Models = new WebApplication1.Models.ListModel();
 }