Beispiel #1
0
 public ActionResult GetOrders()
 {
     var musician = _musicianService.GetMusicianById(Guid.Parse(User.Identity.GetUserId()));
     var orderDTOs = _orderService.GetAll();
     List<OrderViewModel> orderViewModels = new List<OrderViewModel>();
     foreach (var orderDTO in orderDTOs)
     {
         orderDTO.MusicInstrument = _InstrumentService.GetById(orderDTO.MusicInstrumentId);
         orderViewModels.Add(_mapper.Map<OrderDTO, OrderViewModel>(orderDTO));               
     }
     List<MusicInstrumentViewModel> musicInstrumentViewModels = new List<MusicInstrumentViewModel>();
     return View(orderViewModels.Where(orderViewModel => orderViewModel.MusicianId == null && orderViewModels.Contains());
 }
Beispiel #2
0
        public ActionResult GetOrders()
        {
            MusicianDTO musician = _musicianService.GetMusicianById(Guid.Parse(User.Identity.GetUserId()));

            s_logger.Info("User " + musician.Id + " get url " + HttpContext.Request.Url.AbsoluteUri);
            List <OrderDTO> orderDTOs       = _orderService.GetAll();
            var             orderViewModels = new List <OrderViewModel>();

            foreach (var orderDTO in orderDTOs)
            {
                orderDTO.MusicInstrument = _musicInstrumentService.GetById(orderDTO.MusicInstrumentId);
                orderViewModels.Add(_mapper.Map <OrderDTO, OrderViewModel>(orderDTO));
            }
            List <MusicInstrumentViewModel> musicInstrumentViewModels = new List <MusicInstrumentViewModel>();

            return(View(orderViewModels.Where(orderViewModel => orderViewModel.MusicianId == null)));
        }
Beispiel #3
0
        public async Task <ActionResult> ChangeMusicInstruments(MusicInstrumentForDropdown musicInstrumentForDropdown)
        {
            MusicInstrumentDTO musicInstrumentDTO = _InstrumentService.GetById(musicInstrumentForDropdown.MusicInstrumentId);
            ICollection <MusicInstrumentDTO> musicInstrumentDTOs = new List <MusicInstrumentDTO>();

            musicInstrumentDTOs.Add(musicInstrumentDTO);
            await _musicianService.AddMusicInstrumentsToMusician(musicInstrumentDTOs, Guid.Parse(User.Identity.GetUserId()));

            return(RedirectToAction("Index", "Home"));
        }
        public JsonResult GetAllOrders()
        {
            var orderDTOs = _orderService.GetAll();
            List <OrderViewModel> orderViewModels = new List <OrderViewModel>();

            foreach (var orderDTO in orderDTOs)
            {
                orderDTO.MusicInstrument = _InstrumentService.GetById(orderDTO.MusicInstrumentId);
                orderViewModels.Add(_mapper.Map <OrderDTO, OrderViewModel>(orderDTO));
            }
            return(Json(orderViewModels, JsonRequestBehavior.AllowGet));
        }
Beispiel #5
0
        public ActionResult GetClientOrders(OrderViewModel order)
        {
            var currentUser = _applicationUserService.GetUserById(Guid.Parse(User.Identity.GetUserId()));
            var orderDTOs   = _orderService.GetAll();
            List <OrderViewModel> orderViewModels = new List <OrderViewModel>();

            foreach (var orderDTO in orderDTOs)
            {
                orderDTO.MusicInstrument = _InstrumentService.GetById(orderDTO.MusicInstrumentId);
                orderViewModels.Add(_mapper.Map <OrderDTO, OrderViewModel>(orderDTO));
            }
            return(View(orderViewModels.Where(orderViewModel => orderViewModel.ClientId == currentUser.Id)));
        }