public async Task <IViewComponentResult> InvokeAsync(string viewName = null) { if (viewName.ToLowerInvariant() == ViewName.Form.ToString().ToLowerInvariant()) { return(View("WorkForm", new WorkViewModel { Projects = await _projectService.GetAll() })); } if (viewName.ToLowerInvariant() == ViewName.List.ToString().ToLowerInvariant()) { return(View("WorkList", await _workService.GetAll())); } if (viewName.ToLowerInvariant() == ViewName.Today.ToString().ToLowerInvariant()) { return(View("WorkList", await _workService.GetAll("today"))); } if (viewName.ToLowerInvariant() == ViewName.Yesterday.ToString().ToLowerInvariant()) { return(View("WorkList", await _workService.GetAll("yesterday"))); } if (viewName.ToLowerInvariant() == ViewName.Old.ToString().ToLowerInvariant()) { return(View("WorkList", await _workService.GetAll("old"))); } return(View(await _workService.GetAll())); }
private void ButtonAddWork_Click(object sender, RoutedEventArgs e) { WorkViewModel workViewModel = new WorkViewModel(); workViewModel.Begin = new DateTime(1990, 01, 01); EditWork dialog = new EditWork(workViewModel); var result = dialog.ShowDialog(); if (result == true) { workService.CreateWork(workViewModel); } works = workService.GetAll(); cBoxWork.DataContext = works; }
public MainWindow() { InitializeComponent(); workService = new WorkService("CoursesContext1"); works = workService.GetAll(); cBoxWork.DataContext = works; }
public async Task <IViewComponentResult> InvokeAsync(string viewName = null) { if (viewName.ToLowerInvariant() == ViewName.Form.ToString().ToLowerInvariant()) { var works = await _workService.GetAll(Day.Yesterday.ToString()); return(View("ObstacleForm", new ObstacleViewModel { Works = works })); } if (viewName.ToLowerInvariant() == ViewName.List.ToString().ToLowerInvariant()) { return(View("ObstacleList", await _obstacleService.GetAll())); } if (viewName.ToLowerInvariant() == ViewName.Today.ToString().ToLowerInvariant()) { return(View("ObstacleList", await _obstacleService.GetAll("today"))); } if (viewName.ToLowerInvariant() == ViewName.Yesterday.ToString().ToLowerInvariant()) { return(View("ObstacleList", await _obstacleService.GetAll("yesterday"))); } if (viewName.ToLowerInvariant() == ViewName.Old.ToString().ToLowerInvariant()) { return(View("ObstacleList", await _obstacleService.GetAll("old"))); } return(View(await _obstacleService.GetAll())); }
public ActionResult <List <Work> > GetAll(Genre?genre) { var baseQuery = workService.GetAll().AsNoTracking(); if (genre != null) { baseQuery = baseQuery.Where(w => w.Genre == genre); } return(baseQuery.Include(w => w.Scenes).ToList()); }
public async Task <IActionResult> GetAll([FromBody] DateTime date, [FromQuery] WorkPeriod period) { var result = await _workService.GetAll(date, period); if (result != null && result.Count > 0) { return(Ok(result)); } else { return(NotFound()); } }
public JsonResult GetAllWork() { var WorkList = _pieceWorkService.GetAll(); return(Json(WorkList)); }
public IActionResult GetAll(int page = 1) { var worksViewModels = _mapper.Map <IEnumerable <Work>, IEnumerable <WorkShortViewModel> >(_workService.GetAll()); var model = PagingList.Create(worksViewModels, 5, page); return(View(model)); }
public IActionResult GetAll() { var res = _workService.GetAll(); return(Ok(res)); }
public IActionResult Index() { var list = _workService.GetAll(); return(View(list)); }
public async Task <IList <Work> > GetAll() { return(await _workService.GetAll()); }