Example #1
0
 public IActionResult Create(Employee emp)
 {
     if (!ModelState.IsValid)
     {
         return(View(emp));
     }
     _context.Add(emp);
     _context.SaveChanges();
     return(RedirectToAction("Index"));
 }
        public async Task <IActionResult> Create([Bind("Id,Name,Disease")] Patient patient)
        {
            if (ModelState.IsValid)
            {
                _context.Add(patient);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(patient));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Speciality")] Doctor doctor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(doctor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(doctor));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Address,Phones")] Hospital hospital)
        {
            if (ModelState.IsValid)
            {
                _context.Add(hospital);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(hospital));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Designation,BirthDate,Salary,Grade,Email,Website,CellPhone")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
Example #6
0
        public async Task <IActionResult> Create([Bind("Id,Name,Age,Country,Occupation")] Person person)
        {
            if (ModelState.IsValid)
            {
                _context.Add(person);
                await _context.SaveChangesAsync();

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