Esempio n. 1
0
        public IActionResult Index()
        {
            ApplicationUser   LoginUser = new UserBaseRepository(_dbContext).Find(s => s.UserName == User.Identity.Name.ToString());
            ComBaseRepository comNew    = new WebDataLibrary.Models.ComBaseRepository(_dbContext);


            Web_Com newCom = new Web_Com
            {
                ComName       = "京翔布鞋",
                CreateUser    = LoginUser,
                DbName        = "Shop",
                DbVer         = 1,
                DetailAddress = "四川成都",
                EditDate      = DateTime.Now,
                EditUser      = LoginUser,
                InDate        = DateTime.Now,
                Money         = 1.20M,
                Pid           = "123456x",
                Name          = "showmu",
                Tel           = "18108195338"
            };

            if (comNew.Exist(s => s.ComName == "京翔布鞋"))
            {
                ViewData["Message"] = " 京翔布鞋已存在,换过名字罢!";
            }
            else
            {
                comNew.Add(newCom, true);
                comNew.Save();
                if (comNew.Exist(s => s.ComName == "京翔布鞋"))
                {
                    ViewData["Message"] = " 京翔布鞋添加成功!";
                }
                else
                {
                    ViewData["Message"] = "测试添加失败.";
                }
            }

            return(View());
        }
Esempio n. 2
0
        public IActionResult Contact()
        {
            ViewData["Message"] = "测试添加公司.";

            Web_Com newCom = new Web_Com {
                ComId         = 1,
                ComName       = "京翔布鞋",
                CreateUser    = new ApplicationUser(),
                DbName        = "Shop",
                DbVer         = 1,
                DetailAddress = "四川成都",
                EditDate      = DateTime.Now,
                EditUser      = new ApplicationUser(),
                InDate        = DateTime.Now,
                Money         = 1,
                Pid           = "123456x",
                Name          = "showmu",
                Tel           = "18108195338"
            };


            return(View());
        }