Esempio n. 1
0
        public ActionResult Index()
        {
            shAboutService _about = new shAboutService();
            shAboutu       about  = _about.DanhSachAbout().OrderBy(x => x.AboutId).FirstOrDefault();

            IEnumerable <shAboutu> dsChildAbout = _about.DanhSachAbout_ByParentId(about.AboutGuid).OrderBy(x => x.AboutId);

            ViewBag.dsChildAbout = dsChildAbout;
            return(View(about));
        }
Esempio n. 2
0
        public ActionResult Details(int?id)
        {
            shAboutService _about = new shAboutService();
            shAboutu       about  = new shAboutu();

            if (id.HasValue)
            {
                about = _about.FindList().Where(x => x.AboutId == id).FirstOrDefault();
            }

            IEnumerable <shAboutu> dsChild = _about.DanhSachAbout_ByParentId(about.AboutGuid);

            ViewBag.dsChild = dsChild;

            return(View(about));
        }
Esempio n. 3
0
        public ActionResult Create(string id)
        {
            ViewBag.BannerGuid = id;
            shAboutService _about = new shAboutService();
            shAboutu       about  = new shAboutu();

            if (!string.IsNullOrWhiteSpace(id))
            {
                about = _about.FindByKey(id);
            }

            IEnumerable <shAboutu> dsAbout = _about.DanhSachAbout();

            ViewBag.Parent = new SelectList(dsAbout, "AboutGuid", "AboutTitle", about.ParentId);

            return(View(about));
        }
Esempio n. 4
0
        public ActionResult Create(string AboutGuid, string AboutTitle, string AboutName,
                                   string AboutContent, int?Year, string Parent, string Sign,
                                   string ImageUrl, int?SortOrder,
                                   bool?Status, string Url)
        {
            using (var context = new ShopOnlineDb())
            {
                using (var dbContextTransaction = context.Database.BeginTransaction())
                {
                    try
                    {
                        shAboutService _about = new shAboutService();
                        shAboutu       about  = new shAboutu();

                        about = _about.Insert_About(
                            AboutGuid,
                            null,
                            AboutTitle,
                            AboutName,
                            AboutContent,
                            Year,
                            Sign,
                            ImageUrl,
                            Parent,
                            SortOrder,
                            Status,
                            DateTime.Now);

                        dbContextTransaction.Commit();
                    }
                    catch (Exception ex)
                    {
                        dbContextTransaction.Rollback();
                    }
                }
            }



            return(RedirectToAction("Index"));
        }