コード例 #1
0
        public void Eliminar(int id)
        {
            periods oPeriod = new periods
            {
                period_id = id,
            };

            oRepositorio.Delete(oPeriod);
            oUnitOfWork.SaveChanges();
        }
コード例 #2
0
        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"));
        }
コード例 #3
0
        public IActionResult Delete([FromRoute] int id)
        {
            var period = _repoPeriod.Get(id);

            if (period == null)
            {
                return(NotFound());
            }
            _repoPeriod.Delete(id);

            return(NoContent());
        }
コード例 #4
0
ファイル: PeriodManager.cs プロジェクト: CodyDuff/SurveyApi
        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();
            }
        }
コード例 #5
0
 public ActionResult Delete(Guid id)
 {
     PeriodRepository.Delete(id);
     PeriodRepository.Save();
     return(Redirect(Url.Action("GetAll", "Period")));
 }