Esempio n. 1
0
        public IActionResult AddDoctor([FromBody] NewDoctorRequest newDoctorRequest)
        {
            var modifiedEntries = _dbService.AddDoctor(newDoctorRequest);

            if (modifiedEntries == 0)
            {
                return(BadRequest("No entries were modified, probably wrong ID was requested."));
            }
            return(Ok($"{modifiedEntries} entries changed."));
        }
Esempio n. 2
0
        public int AddDoctor(NewDoctorRequest newNewDoctorRequest)
        {
            var newDoctor = new Doctor
            {
                FirstName = newNewDoctorRequest.FirstName,
                LastName  = newNewDoctorRequest.LastName,
                Email     = newNewDoctorRequest.Email
            };

            _context.Add(newDoctor);
            return(_context.SaveChanges());
        }