示例#1
0
        public void Delete(int id, string user = "")
        {
            planRepository.Delete(x => x.id == id);

            //ToDo : réaliser une suppression complète ou logique en fonction des droits de l'utilisateur en session
            applicationTraceService.create(new ApplicationTrace
            {
                utilisateur = user,
                action      = Parametres.Action.Suppression.ToString(),
                description = String.Format("Supression du plan plan_id = {0}", id),
            });
        }
        public async Task <IActionResult> Delete(long id)
        {
            var plandelete = await _planRepository.GetById(id);

            if (plandelete != null)
            {
                await _planRepository.Delete(plandelete);

                return(Ok(plandelete));
            }
            else
            {
                return(Ok("No Existe"));
            }
        }
示例#3
0
 public void Delete(int id)
 {
     _planRepository.Delete(id);
 }
示例#4
0
 public void Delete(int idPlan)
 {
     _repository.Delete(idPlan);
 }
示例#5
0
 public void Delete(Plan plan)
 {
     _planRepository.Delete(plan);
     _unitOfWork.Commit();
 }
 public void Delete(int PlanId)
 {
     _planRepository.Delete(PlanId);
 }
示例#7
0
        public bool DeletePlan(int planId)
        {
            var result = _planRepository.Delete(planId);

            return(result);
        }
示例#8
0
 public async Task Delete(int id)
 {
     await _planRepository.Delete(id);
 }
示例#9
0
 public bool Delete(int id)
 {
     return(planRepository.Delete(id));
 }
示例#10
0
        public void Update(PlanDTO planDto)
        {
            var existingPlans    = _planRepository.GetByIds(planDto.Ids);
            var plansToRemove    = new List <int>();
            var plansToAdd       = new List <Plan>();
            var plansToUpdate    = new List <int>();
            var planToUpdateData = new Plan();

            foreach (var existingMeal in existingPlans.Meals)
            {
                if (!planDto.MealIds.Contains(existingMeal.Id))
                {
                    var planToRemove = _planRepository.GetByMealId(existingMeal.Id, existingPlans.Date, existingPlans.CompanyId, existingPlans.EditableFrom, existingPlans.EditableTo, existingPlans.Shifts);
                    plansToRemove.Add(planToRemove.Id);
                }
            }

            foreach (var mealId in planDto.MealIds)
            {
                if (!existingPlans.Meals.Exists(x => x.Id == mealId))
                {
                    plansToAdd.Add(new Plan
                    {
                        Date         = planDto.Date,
                        EditableFrom = planDto.EditableFrom,
                        EditableTo   = planDto.EditableTo,
                        Shifts       = string.Join(",", planDto.Shifts),
                        CompanyId    = planDto.CompanyId,
                        MealId       = mealId
                    });
                }
                else
                {
                    var planToUpdate = _planRepository.GetByMealId(mealId, existingPlans.Date, existingPlans.CompanyId, existingPlans.EditableFrom, existingPlans.EditableTo, existingPlans.Shifts);
                    plansToUpdate.Add(planToUpdate.Id);

                    planToUpdateData = new Plan
                    {
                        Date         = planDto.Date,
                        EditableFrom = planDto.EditableFrom,
                        EditableTo   = planDto.EditableTo,
                        Shifts       = string.Join(",", planDto.Shifts),
                        CompanyId    = planDto.CompanyId,
                        MealId       = mealId
                    };
                }
            }

            if (plansToRemove.Count > 0)
            {
                _planRepository.Delete(plansToRemove);
            }

            if (plansToAdd.Count > 0)
            {
                _planRepository.Add(plansToAdd);
            }

            if (plansToUpdate.Count > 0)
            {
                _planRepository.Update(plansToUpdate, planToUpdateData);
            }
        }
示例#11
0
 public void DeletePlan(int planID)
 {
     _planRepository.Delete(_planRepository.GetById(planID));
 }