Beispiel #1
0
        //Updates the advertisement
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Advertisement).State = EntityState.Modified;

            try
            {
                _context.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AdvertisementExists(Advertisement.Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Beispiel #2
0
        //Adds  a candidate to database.
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Candidate.Add(Candidate);
            _context.SaveChanges();

            return(RedirectToPage("./Index"));
        }
Beispiel #3
0
        //Adds an advertisement to database.
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Advertisement.Add(Advertisement);
            _context.SaveChanges();

            return(RedirectToPage("./Index"));
        }
Beispiel #4
0
        //Removes the application . selects the appplication using a linq query.
        public IActionResult OnPost(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Application = (from application in _context.Application
                           where application.Id == id
                           select application).FirstOrDefault();

            if (Application != null)
            {
                _context.Application.Remove(Application);
                _context.SaveChanges();
            }

            return(RedirectToPage("./Index"));
        }
Beispiel #5
0
        //Deletes a employer from databse uses a liq query to get the employer.
        public IActionResult OnPost(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Employer = (from employer in _context.Employer
                        where employer.Id == id
                        select employer).FirstOrDefault();

            if (Employer != null)
            {
                _context.Employer.Remove(Employer);
                _context.SaveChanges();
            }

            return(RedirectToPage("./Index"));
        }
Beispiel #6
0
        //Removes the advertisement uses a linq query to get the advertisement.
        public IActionResult OnPost(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Advertisement = (from advertisement in _context.Advertisement
                             where advertisement.Id == id
                             select advertisement).FirstOrDefault();

            if (Advertisement != null)
            {
                _context.Advertisement.Remove(Advertisement);
                _context.SaveChanges();
            }

            return(RedirectToPage("./Index"));
        }
Beispiel #7
0
        //Removes the candidate used a linq query to get the record.
        public IActionResult OnPost(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Candidate = (from candidate in _context.Candidate

                         where candidate.Id == id
                         select candidate).FirstOrDefault();

            if (Candidate != null)
            {
                _context.Candidate.Remove(Candidate);
                _context.SaveChanges();
            }

            return(RedirectToPage("./Index"));
        }