Ejemplo n.º 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"));
            }
        }
Ejemplo n.º 3
0
 public void Delete(int id)
 {
     _planRepository.Delete(id);
 }
Ejemplo n.º 4
0
 public void Delete(int idPlan)
 {
     _repository.Delete(idPlan);
 }
Ejemplo n.º 5
0
 public void Delete(Plan plan)
 {
     _planRepository.Delete(plan);
     _unitOfWork.Commit();
 }
Ejemplo n.º 6
0
 public void Delete(int PlanId)
 {
     _planRepository.Delete(PlanId);
 }
Ejemplo n.º 7
0
        public bool DeletePlan(int planId)
        {
            var result = _planRepository.Delete(planId);

            return(result);
        }
Ejemplo n.º 8
0
 public async Task Delete(int id)
 {
     await _planRepository.Delete(id);
 }
Ejemplo n.º 9
0
 public bool Delete(int id)
 {
     return(planRepository.Delete(id));
 }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 11
0
 public void DeletePlan(int planID)
 {
     _planRepository.Delete(_planRepository.GetById(planID));
 }