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); }
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); }
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); }
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); }
public ActionResult SaveJob(SA_Job UserNews) { UserNews.CreatedTime = DateTime.Now; if (UserNews.id == 0) { Obj.AddJob(UserNews); } else { Obj.EditJob(UserNews); } return(RedirectToAction("Job")); }
public ActionResult EditJob(int id) { SA_Job obj = Obj.GetJobByid(id); return(View("AddJob", obj)); }
public ActionResult AddJob() { var Model = new SA_Job(); return(View(Model)); }