Example #1
0
 public ActionResult Index(Job newjob)
 {
     context.Jobs.Add(newjob);
     context.SaveChanges();
     viewmodel.Companies = context.Companies.Include("Jobs").ToList();
     return View(viewmodel);
 }
Example #2
0
 public ActionResult Delete(Job id)
 {
     Job JobToRemove = context.Jobs.Find(id);
        context.Jobs.Remove(JobToRemove);
        context.SaveChanges();
        return RedirectToAction("Index");
 }
Example #3
0
 public ActionResult Update( int id, Job Jobtoupdate)
 {
     Job JobUpdating = new Job();
     JobUpdating = context.Jobs.Find(id);
     JobUpdating.Id = Jobtoupdate.Id;
     JobUpdating.Salary = Jobtoupdate.Salary;
     JobUpdating.Title = Jobtoupdate.Title;
     context.SaveChanges();
     return RedirectToAction("Index");
 }
Example #4
0
        public IHttpActionResult Delete(int id)
        {
            try
            {
                Job JobToRemove = new Job();
                JobToRemove = context.Jobs.Find(id);
                context.Jobs.Remove(JobToRemove);
                return Ok();
            }
            catch(Exception ex)
            {
                return InternalServerError(ex);

            }
        }
Example #5
0
 public IHttpActionResult Put(int id, [FromBody]Job JObupdated)
 {
     try
     {
         Job Jobupdating = new Job();
         Jobupdating.Id = JObupdated.Id;
         Jobupdating.Salary = Jobupdating.Salary;
         Jobupdating.Title = Jobupdating.Title;
         context.SaveChanges();
         return Ok(JObupdated);
     }
     catch (Exception ex)
     {
         return InternalServerError(ex);
     }
 }
Example #6
0
 public ActionResult Update(int id)
 {
     Job JobUpdating = new Job();
     JobUpdating = context.Jobs.Find(id);
     return View(JobUpdating);
 }