예제 #1
0
        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()));
        }
예제 #2
0
        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;
        }
예제 #3
0
 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()));
        }
예제 #5
0
        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());
        }
예제 #6
0
        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());
            }
        }
예제 #7
0
        public JsonResult GetAllWork()
        {
            var WorkList = _pieceWorkService.GetAll();

            return(Json(WorkList));
        }
예제 #8
0
        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));
        }
예제 #9
0
        public IActionResult GetAll()
        {
            var res = _workService.GetAll();

            return(Ok(res));
        }
예제 #10
0
        public IActionResult Index()
        {
            var list = _workService.GetAll();

            return(View(list));
        }
예제 #11
0
 public async Task <IList <Work> > GetAll()
 {
     return(await _workService.GetAll());
 }