public IActionResult List() { var claimsIdentity = this.User.Identity as ClaimsIdentity; var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; bool succes = Int32.TryParse(userId, out var ownerId); if (succes) { return(Ok(_planRepository.GetAll().Where(e => e.OwnerId == ownerId))); } return(Ok(_planRepository.GetAll())); }
[HttpGet] // Es opcional declarar esta anotacion public IActionResult Edit(int?id) { if (id == null) { return(NotFound()); } Materia?materia = _materiaRepository.GetOne((int)id); if (materia == null) { return(NotFound()); } return(View(new EditMateriaViewModel(materia, _planRepository.GetAll()))); }
public IList <DayPlanFlag> GetByMonth(DateTime month) { List <DayPlanFlag> monthFlags = new List <DayPlanFlag>(); var lastMonthDay = month.AddMonths(1).Subtract(TimeSpan.FromDays(1)); var monthPlanDayList = _repository.GetAll() .Where( p => p.PlanDate >= month && p.PlanDate <= lastMonthDay) .Select(p => p.PlanDate) .Distinct() .ToList(); for (DateTime day = month; day <= lastMonthDay; day = day.AddDays(1)) { bool hasPlan = monthPlanDayList.Any(mpd => mpd == day); if (hasPlan) { monthFlags.Add(new DayPlanFlag() { Day = day, HasPlan = true }); } } return(monthFlags); }
public void GetAllPlans_ReturnsAll() { var allPlans = _planRepository.GetAll(); Assert.IsAssignableFrom <IQueryable <PlanEntity> >(allPlans); Assert.NotEmpty(allPlans); }
public async Task <List <PlanView> > GetAllPlansAsync() { var result = _planRepository.GetAll(); var items = await result .Where(p => p.IsActive) .ProjectToPlanView().ToListAsync(); return(items); }
// GET: Plan public ActionResult Index() { PlanViewModel _vm = new PlanViewModel(); _vm.Plans = new SelectList(_contextPlan.GetAll(), "Id", "Name"); _vm.Source = new SelectList(_contextAreaCodeSource.GetAll(), "Id", "Code"); _vm.Destiny = new SelectList(_contextAreaCodeDestiny.GetAll(), "Id", "Code"); return(View(_vm)); }
public IEnumerable <Plan> GetAll() { return(_planRepository.GetAll()); }
public List <Plan> GetAll() { return(_repository.GetAll()); }
public IEnumerable <Plan> DonneTous() { return(planRepository.GetAll()); }
public async Task <IActionResult> Get() { var plans = await _planRepository.GetAll(); return(Ok(plans.Where(x => !x.IsDelete))); }
public void SubscribeToPlan(string planId, int tenantId) { Models.Plan plan = _planRepository.GetAll().Where(p => p.PlanId == planId).FirstOrDefault(); plan.TenantId = tenantId; _planRepository.Update(plan); }
public async Task <IEnumerable <Plan> > GetAll() { return(await _planRepository.GetAll()); }
public IActionResult Get() { var result = _repository.GetAll(); return(Ok(result)); }
public IEnumerable <BLModel.Plan> getAll() { IEnumerable <BLModel.Plan> _plan = _planRepository.GetAll().Select(plan => new BLModel.Plan().InjectFrom(plan)).Cast <BLModel.Plan>().OrderBy(plan => plan.PlanID).ToList(); return(_plan); }