public void Eliminar(int id) { periods oPeriod = new periods { period_id = id, }; oRepositorio.Delete(oPeriod); oUnitOfWork.SaveChanges(); }
public void DeletePeriod() { Period toDelete = repo.GetUniq(p => p.Title == "Remaining"); Assert.IsNotNull(repo.GetUniq(p => p.Title == "Remaining")); repo.Delete(toDelete); repo.Save(); Assert.IsNull(repo.GetUniq(p => p.Title == "Remaining")); Assert.IsNull(ctx.PricePerPersonSet.FirstOrDefault(p => p.Title == "Prix adulte room1 reste de l'année")); }
public IActionResult Delete([FromRoute] int id) { var period = _repoPeriod.Get(id); if (period == null) { return(NotFound()); } _repoPeriod.Delete(id); return(NoContent()); }
public void Delete(int periodId) { using (IUnitOfWork unitOfWork = context.CreateUnitOfWork()) { IEnumerable <Assignment> assignments = assignmentRepo.Get(null, null, periodId); foreach (Assignment assignment in assignments) { if (!assignmentRepo.Delete(assignment)) { throw new FailedOperationException("Failed to delete Assignment.", assignment); } } Period period = periodRepo.GetById(periodId); if (!periodRepo.Delete(period)) { throw new FailedOperationException("Failed to delete Period.", period); } unitOfWork.SaveChanges(); } }
public ActionResult Delete(Guid id) { PeriodRepository.Delete(id); PeriodRepository.Save(); return(Redirect(Url.Action("GetAll", "Period"))); }