Esempio n. 1
0
        public async Task <bool> AddJob(SA_Job News)
        {
            //  News.CreatedDate = DateTime.Now;
            _context.SA_Job.Add(News);
            int x = await _context.SaveChangesAsync();

            return(x == 0 ? false : true);
        }
Esempio n. 2
0
        public async Task <bool> UpdateJob(SA_Job News)
        {
            _context.Entry(News).State = EntityState.Modified;
            //  News.ModeifiedDate = DateTime.Now;
            int x = await _context.SaveChangesAsync();

            return(x == 0 ? false : true);
        }
Esempio n. 3
0
        public bool DeleteJob(int NewsId)
        {
            //  News.CreatedDate = DateTime.Now;
            SA_Job EditNews = _context.SA_Job.Where(News => News.id == NewsId).FirstOrDefault();

            _context.Entry(EditNews).State = EntityState.Deleted;
            int x = _context.SaveChanges();

            return(x == 0 ? false : true);
        }
Esempio n. 4
0
        public bool EditJob(SA_Job News)
        {
            //  News.CreatedDate = DateTime.Now;
            SA_Job EditNews = _context.SA_Job.Where(Cat => Cat.id == News.id).FirstOrDefault();

            EditNews.JobName               = News.JobName;
            EditNews.JobDiscription        = News.JobDiscription;
            EditNews.Meta                  = News.Meta;
            EditNews.MetaDiscription       = News.MetaDiscription;
            _context.Entry(EditNews).State = EntityState.Modified;
            int x = _context.SaveChanges();

            return(x == 0 ? false : true);
        }
Esempio n. 5
0
        public ActionResult SaveJob(SA_Job UserNews)
        {
            UserNews.CreatedTime = DateTime.Now;

            if (UserNews.id == 0)
            {
                Obj.AddJob(UserNews);
            }
            else
            {
                Obj.EditJob(UserNews);
            }
            return(RedirectToAction("Job"));
        }
Esempio n. 6
0
        public ActionResult EditJob(int id)
        {
            SA_Job obj = Obj.GetJobByid(id);

            return(View("AddJob", obj));
        }
Esempio n. 7
0
        public ActionResult AddJob()
        {
            var Model = new SA_Job();

            return(View(Model));
        }