Exemple #1
0
        public async Task <IActionResult> Create([Bind("Id,Name,Mobile,Email")] Client client)
        {
            if (ModelState.IsValid)
            {
                _context.Add(client);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(client));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Profession,Mobile,Skills,ExperienceInYears,IsBooked,HourlyRate")] Professional professional)
        {
            if (ModelState.IsValid)
            {
                _context.Add(professional);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(professional));
        }
Exemple #3
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            var hire = await _context.Hire.Include(h => h.Professional).FirstOrDefaultAsync(h => h.Id == id);

            hire.Professional.IsBooked = false;
            _context.Hire.Remove(hire);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }