public async Task <IActionResult> PutRoaster([FromRoute] int id, [FromBody] RoasterOfDoctor roaster)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     if (id != roaster.RoasterOfDoctorId)
     {
         return(BadRequest());
     }
     try
     {
         _repo.Update(roaster);
         var save = await _repo.SaveAsync(roaster);
     }
     catch (DbUpdateConcurrencyException)
     {
         if (!RoasterExists(id))
         {
             return(NotFound());
         }
         else
         {
             throw;
         }
     }
     return(NoContent());
 }
        public async Task PostRoaster(RoasterOfDoctor roaster, int doctorId)
        {
            Doctor doctor = _context.Doctors.Find(doctorId);
            List <RoasterOfDoctor> OldroasterOfDoctors = await _context.RoasterOfDoctors.Include("Chamber")
                                                         .Where(x => x.Chamber.Doctor.DoctorId == doctorId
                                                                &&
                                                                x.Date == roaster.Date).ToListAsync();

            bool IsExist = false;

            foreach (var item in OldroasterOfDoctors)
            {
                TimeSpan start    = item.TimeStart;
                TimeSpan end      = item.TimeEnd;
                TimeSpan newStart = roaster.TimeStart;

                if ((newStart >= start) && (newStart <= end))
                {
                    IsExist = true;
                }
            }
            if (IsExist != true)
            {
                _context.RoasterOfDoctors.Add(roaster);
                await _context.SaveChangesAsync();
            }
        }
        //Task PostRoaster(RoasterOfDoctor roaster, int doctorId)
        public async Task <ActionResult> PostRoaster([FromRoute] int doctorId, [FromBody] RoasterOfDoctor roaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            await _nonGenirec.PostRoaster(roaster, doctorId);

            return(CreatedAtAction("GetRoasters", new { id = roaster.RoasterOfDoctorId }, roaster));
        }