public IActionResult Details(int id) { Project projectFromDb = _appContext.Projects.FirstOrDefault(x => x.Id == id); Status status = _appContext.Statuses.FirstOrDefault(x => x.Id == projectFromDb.StatusId); List <HomeTagViewModel> tags = new List <HomeTagViewModel>(); var selectedTags = _appContext.TagProjects.ToArray(); foreach (var item in selectedTags) { if (item.ProjectId == id) { Tag tag = _appContext.Tags.FirstOrDefault(x => x.Id == item.TagId); HomeTagViewModel tagViewModel = new HomeTagViewModel() { Name = tag.Naam }; tags.Add(tagViewModel); } } HomeDetailViewModel model = new HomeDetailViewModel() { Titel = projectFromDb.Titel, Beschrijving = projectFromDb.Beschrijving, Foto = projectFromDb.Foto, Status = status.Naam, Tags = tags, }; return(View(model)); }
public ViewResult Details(int?id) { //throw new Exception("I made an exception"); logger.LogTrace("Log Trace"); logger.LogDebug("Log Debug"); logger.LogInformation("Log Information"); logger.LogWarning("Log Warning"); logger.LogError("Log Error"); logger.LogCritical("Log Critical"); Employee employee = _employeeRepository.GetEmployee(id.Value); if (employee == null) { Response.StatusCode = 404; return(View("EmployeeNotFound", id.Value)); } HomeDetailViewModel homeDetailViewModel = new HomeDetailViewModel { Employee = employee, PageTitle = "Employee Details" }; return(View(homeDetailViewModel)); }
//[Route("/Home/Details/{id}")] public ViewResult Details(int?id) { //ViewBag.Employee = employeeRepository.Get(id); //var employee = employeeRepository.Get(id); //ViewBag.TitleName = "Employee Details"; try { int.Parse(id.Value.ToString()); var employee = employeeRepository.Get(id.Value); if (employee == null) { //ViewBag.id = id.Value; return(View("~/Views/Error/EmployeeNotFound.cshtml", id.Value)); } var detailViewModel = new HomeDetailViewModel() { Employee = employeeRepository.Get(id.Value), TitleName = "Employee Details" }; return(View(detailViewModel)); } catch (Exception e) { throw e; } }
public IActionResult Details(int id) { Film filmFromDb = _appContext.Films.FirstOrDefault(x => x.Id == id); Rating[] ratingsFromDb = _appContext.Ratings.ToArray(); List <Rating> ratings = new List <Rating>(); IdentityUser[] users = _appContext.Users.ToArray(); UserFilmGezienStatus[] userFilmGezienStatusFromDb = _appContext.UserFilmGeziens.Where(x => x.FilmId == id).ToArray(); HomeDetailViewModel model = new HomeDetailViewModel() { Titel = filmFromDb.Titel, Beschrijving = filmFromDb.Beschrijving, Foto = filmFromDb.Foto, UserFilmGezienStatuses = userFilmGezienStatusFromDb }; foreach (var item in ratingsFromDb) { var user = users.FirstOrDefault(x => x.Id == item.UserId); item.User.UserName = user.UserName; ratings.Add(item); } model.Ratings = ratings; return(View(model)); }
public ViewResult Random() { HomeDetailViewModel homeDetailViewModel = new HomeDetailViewModel() { Random = _CategoryRepository.GetRandom() }; return(View(homeDetailViewModel)); }
public ViewResult Index(string SearchTerm, string category) { HomeDetailViewModel homeDetailViewModel = new HomeDetailViewModel() { SearchTerm = _CategoryRepository.GetJokes(SearchTerm, category), }; return(View(homeDetailViewModel)); }
public ActionResult Homedetail(int id) { ViewBag.Message = "Your contact page."; ViewBag.IndexHomeDetail = id; HomeDetailViewModel hdvm = new HomeDetailViewModel(); hdvm.TargetBien = uow.GetTargetBienModel(id); return(View(hdvm)); }
public ViewResult Detail(int id) { var detailViewModel = new HomeDetailViewModel() { book = bookRepository.Get(id) }; return(View(detailViewModel)); }
// [Route("{id?}")] public ViewResult Detail(int?id) { Employee model = _employeeRepository.GetEmployeeById(id ?? 1); HomeDetailViewModel homeDetailViewModel = new HomeDetailViewModel() { Employee = model, title = "BAPS" }; return(View(homeDetailViewModel)); }
public ViewResult Details(int?id) { HomeDetailViewModel model = new HomeDetailViewModel() { Employee = _service.GetEmployeeData(id ?? 1), PageTitle = "Employee Details" }; return(View(model)); }
public ViewResult Details(string category) { HomeDetailViewModel homeDetailViewModel = new HomeDetailViewModel() { Category = _CategoryRepository.GetCategory(category), pageheader = "ChuckNorris", pagetitle = "Catagories" }; return(View(homeDetailViewModel)); }
public async Task <T> FetchDashboard(HomeDetailViewModel model) { string requestURL = "/path/{Parameter}"; var httpMethod = BaseNetworkAccessEnum.Get; var parameters = new Dictionary <string, ParameterTypedValue>() { //{"Parameter", model.Property}, }; return(await _NetworkInterface(requestURL, parameters, null, httpMethod)); }
public async Task <ActionResult <HomeDetailViewModel> > GetHomes() { var categories = await _context.Categories.Include(c => c.Forums).Select(c => new CategoryListViewModel { Id = c.Id, CategoryName = c.CategoryName, Priority = c.Priority, Forums = c.Forums.Select(f => new ForumListViewModel { Id = f.Id, Title = f.Title, Slug = f.Slug, Description = f.Description, ImageUrl = f.ImageUrl, PostsCount = f.Posts.Count(), LatestPost = f.Posts.Select(p => new PostSummaryViewModel { Id = p.Id, Slug = p.Slug, Title = p.Title, PostedAt = p.PostedAt, Author = GetAuthor(p.User) }).OrderByDescending(p => p.PostedAt).Take(1).FirstOrDefault() }) }).OrderBy(c => c.Priority).ToListAsync(); var latestPosts = await _context.Posts.Include(p => p.Forum).Select(p => new PostSummaryViewModel { Id = p.Id, Slug = p.Slug, Title = p.Title, PostedAt = p.PostedAt, Author = GetAuthor(p.User) }).OrderByDescending(p => p.PostedAt).Take(5).ToListAsync(); var latestReplies = await _context.Replies.Include(r => r.Post).Select(r => new ReplySummaryViewModel { Id = r.Id, PostId = r.Post.Id, PostSlug = r.Post.Slug, Title = r.Post.Title, RepliedAt = r.RepliedAt, Author = GetAuthor(r.User) }).OrderByDescending(r => r.RepliedAt).Take(5).ToListAsync(); var model = new HomeDetailViewModel() { Categories = categories, LatestPosts = latestPosts, LatestReplies = latestReplies }; return(model); }
public IActionResult Details(int id) { var employee = employeeRepository.Get(id); var detailViewModel = new HomeDetailViewModel() { employee = employee, TitleName = "Employee Detail" }; return(View(detailViewModel)); }
public HomeDetailPage() { InitializeComponent(); m_messaging = App.Container.Resolve <IMessageQueue>(); m_viewModel = App.Container.Resolve <HomeDetailViewModel>(); m_viewModel.AddMangaList(App.Container.Resolve <BookPreviewListViewModel>()); m_viewModel.AddRecommendationList(App.Container.Resolve <BookPreviewListViewModel>()); m_viewModel.LoadItems(); BindingContext = m_viewModel; }
public ActionResult Detail() { var id = Request["id"]; var objectId = ObjectId.Parse (id); var data = _repository.FindById (objectId).Result; var model = new HomeDetailViewModel (){ Name=data.name, Email=data.email, Age=data.age }; return View (model); }
public ViewResult Details(int?id = 3) //nullable int { //throw new Exception("exception"); logger.LogTrace("Trace log"); logger.LogWarning("Warning Log"); logger.LogDebug("Debug Log"); logger.LogError("Error Log"); logger.LogCritical("Critical log"); logger.LogInformation("Information Log"); Employee employee = _employeeRepository.GetEmployee(id ?? 1); //when returning views, the default view selected is in Views/ControllerName/ActionMethod.cshtml //can be override by passing a relative or absolute filepath to the view method. Relative path is wrt to the Actionname directory and .cshtml is not required //return View("../folder/view"); //for absolute file path, the .cshtml extension is required //return View("/path/to/view.cshtml"); //return View("~/path/to/view.cshtml"); //using viewData to pass data to the view - all data are strings so we have to cast to the required type using 'as' keyword // ViewData["PageTitle"] = "Employee details"; // ViewData["Employee"] = model; //using viewBag to pass data the view - uses dynamic properties on the ViewBag instance //ViewBag.PageTitle = "Employee details"; //ViewBag.Employee = model; //return View(); //passing the model directly to the view - when we don't need to pass additional data //we have to inject it the view using @model directive //return View(model); //using viewModel if (employee == null) { Response.StatusCode = 404; return(View("EmployeeNotFound", id.Value)); } HomeDetailViewModel homeDetailViewModel = new HomeDetailViewModel() { Employee = employee, PageTitle = "Employee Details" }; return(View(homeDetailViewModel)); }
public ViewResult Details(int?id) { Book book = _booksRepository.GetBook(id.Value); if (book == null) { Response.StatusCode = 404; return(View("BookNotFound", id.Value)); } HomeDetailViewModel homeDetailViewModel = new HomeDetailViewModel() { Book = book, PageTitle = "Book details" }; return(View(homeDetailViewModel));; }
public ViewResult Details(int?id) { Employee employee = _employeeRepositoryPattern.GetEmployee(id.Value); if (employee == null) { Response.StatusCode = 404; _logger.LogError($"The employee with Id = {id.Value} cannot be found."); return(View("EmployeeNotFound", id.Value)); } HomeDetailViewModel homeDetailViewModel = new HomeDetailViewModel() { Employee = employee, PageTitle = "Employee Information!" }; return(View(homeDetailViewModel)); }
public ViewResult Details(int?id) { try { var employee = employeeRepository.Get(id.Value); if (employee == null) { return(View("~/Views/Error/EmployeeNotFound.cshtml", id.Value)); } var detailViewModel = new HomeDetailViewModel() { Employee = employee, TitleName = "Employee Detail" }; return(View(detailViewModel)); } catch (Exception e) { throw e; } }
public ViewResult Details(int?id) { try { int.Parse(id.Value.ToString()); var product = productRepository.Get(id.Value); if (product == null) { return(View("~/Views/Error/ProductNotFound.cshtml", id.Value)); } var detailViewModel = new HomeDetailViewModel() { Product = productRepository.Get(id ?? 1), TitleName = "Product Detail" }; return(View(detailViewModel)); } catch (Exception e) { throw e; } }
public ViewResult Detail(int id) { var product = productRepository.Gets().ToList(); var category = categoriesRepository.Gets().ToList(); var categoryID = productRepository.Get(id).CategoriesCategoryId; if (product == null) { return(View("~/Views/Error/ProductNotFound.cshtml")); } var detailsViewModel = new HomeDetailViewModel() { Product = productRepository.Get(id), TitleName = "Product Detail", CategoryName = ( from c in category where c.CategoryId == categoryID select c.CategoryName).FirstOrDefault() }; return(View(detailsViewModel)); }
public ViewResult Details(int?id) { try { int.Parse(id.Value.ToString()); var flower = flowerRepository.Get(id.Value); if (flower == null) { //ViewBag.Id = id.Value; return(View("~/Views/Error/FlowerNotFound.cshtml", id.Value)); } var detailViewModel = new HomeDetailViewModel() { Flower = flowerRepository.Get(id ?? 1), TitleName = "Employee Detail" }; return(View(detailViewModel)); } catch (Exception e) { throw e; } }
public IActionResult Details(int?id) { //throw new Exception("Error in Details Views"); logger.LogTrace("Log Track"); logger.LogDebug("Log Debug"); logger.LogWarning("Log Waring"); logger.LogError(" lOG ERROR"); logger.LogCritical(" LogCritical "); EmployeeModel employee = _employeeRespository.GetEmployee(id.Value); if (employee == null) { Response.StatusCode = 404; return(View("EmployeeNotFound", id.Value)); } HomeDetailViewModel homeDetailViewModel = new HomeDetailViewModel() { Employee = employee, PageTitle = "Employee Detail" }; return(View(homeDetailViewModel)); }
public async Task FetchDashboard(HomeDetailViewModel model, Action <T> completeAction) { var serviceReturnModel = await _Service.FetchDashboard(model); completeAction(serviceReturnModel); }