public async Task <IActionResult> PutTwilioSmsModel([FromRoute] string id, [FromBody] TwilioSmsModel twilioSmsModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != twilioSmsModel.SmsSid) { return(BadRequest()); } _context.Entry(twilioSmsModel).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TwilioSmsModelExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task Isim_alani_bos_kayıt_girtildiginde_hata() { await Task.Delay(new TimeSpan(0, 0, Constants.ThreadSleepDelay)); //Arrange var teacher = new Teacher { BirthDate = new DateTime(2000, 1, 1), FirstName = null, LastName = "Çabuk", Gender = "Male", }; //Act _ = await _asyncTeacherRepository.Insert(teacher); //Assert await Assert.ThrowsAsync <DbUpdateException>(async() => await _asyncTeacherRepository.Save()); _smsDbContext.Entry(teacher).State = EntityState.Detached; }