public void OnGet(int id) { OfferViewModel = _offersService.GetById(id); Products = OfferViewModel.Products.Select(product => new SelectListItem { Value = product.Id.ToString(), Text = product.Name }).ToList(); SelectedProductsIds = OfferViewModel.Products.Select(p => p.Id); Console.WriteLine(); }
public void OnGet(int id) { var menuItem = _offersService.GetById(id); if (menuItem == null) { ErrorMessage = $"There is no offer with ID: {id}"; } else { Offer = menuItem.ToOfferListViewModel(); } }
public AppointmentAdminViewModel GetByIdAdminView(int id) { AppointmentViewModel appointment = _appointmentsService.GetById(id); AppointmentAdminViewModel result = new AppointmentAdminViewModel(); if (appointment != null) { OfferViewModel offer = _offersService.GetById(appointment.offerId); result = _mapper.Map <AppointmentViewModel, AppointmentAdminViewModel>(appointment); result.UserInfo = _userService.GetUserPersonalInfo(appointment.customerId); result.offer = offer; } return(result); }
public IActionResult OnGetDelete(int id) { var offer = _offersService.GetById(id); if (offer == null) { Message = "There is no item with such Id"; OnGet(); return(Page()); } else { _offersService.Delete(offer); OnGet(); return(Page()); } }
public async Task <IActionResult> Get([FromRoute] Guid id) { var result = await _offersService.GetById(id); return(Ok(result)); }