Exemplo n.º 1
0
        public ActionResult AddHeaderContent(int id = 0)
        {
            SA_HomeHeader obj = new SA_HomeHeader();

            if (id > 0)
            {
                obj = _context.SA_HomeHeader.Where(w => w.Id == id).FirstOrDefault();
            }

            if (obj == null)
            {
                obj = new SA_HomeHeader();
            }
            //obj.ProductList = ObjDal.GetProductList();
            //SA_Industry obj = new SA_Industry();
            return(View(obj));
        }
Exemplo n.º 2
0
        public ActionResult SaveHeaderContent(SA_HomeHeader UserNews)
        {
            if (UserNews.Id == 0)
            {
                UserNews.CreatedTime = DateTime.Now;
                _context.SA_HomeHeader.Add(UserNews);
                _context.SaveChangesAsync();
            }
            else
            {
                SA_HomeHeader EditNews = _context.SA_HomeHeader.Where(Cat => Cat.Id == UserNews.Id).FirstOrDefault();
                EditNews.EmailAddress  = UserNews.EmailAddress;
                EditNews.OfficeAddress = UserNews.OfficeAddress;
                EditNews.PhoneNumber   = UserNews.PhoneNumber;

                EditNews.CreatedTime           = UserNews.CreatedTime;
                _context.Entry(EditNews).State = EntityState.Modified;
                int x = _context.SaveChanges();
            }
            return(RedirectToAction("HeaderContent"));
        }