public ActionResult Index(int ID) { var company = CompanyService.Find(ID); if (company == null) { return(HttpNotFound()); } CompanyIndexViewModel model = new CompanyIndexViewModel(); model.BannerImg = company.BannerImg; model.LogoImg = company.LogoImg; model.ID = company.MemberID; model.Name = company.Name; var cityIds = Utilities.GetIdList(company.CityCodeValue); var cityName = string.Join(" - ", CityCateService.GetALL() .Where(x => cityIds.Contains(x.ID)) .ToList().Select(x => x.CateName)); model.CityName = cityName; model.Description = company.Description; model.LinkMan = company.LinkMan; model.Sex = company.Sex; model.Lat = company.Lat; model.Lng = company.Lng; model.Mobile = company.Mobile; model.Phone = company.Phone; model.QQ = company.QQ; model.Categories = GetCompanyCategorise(ID); SetCompanyIndexCategories(model.Categories, ID); return(View(model)); }
public IActionResult Details(int id) { User Company = _context.Users.Include("Jobs").Where(u => u.UserId == id && u.IsCompany == true).FirstOrDefault(); ViewBag.Company = Company; ViewBag.Jobs = Company.Jobs.Where(j => j.IsActive == true).ToList(); if (ViewBag.Company == null) { return(NotFound()); } else { CompanyIndexViewModel data = new CompanyIndexViewModel(); data.Breadcumb = new BreadcumbViewModel { Title = "Company", Path = new Dictionary <string, string>() }; data.Breadcumb.Path.Add("index", "Home"); data.Breadcumb.Path.Add("Company Details", null); ViewBag.Partial = data.Breadcumb; return(View()); } }
public ActionResult viewnotice(int ID, int noticeId) { var company = CompanyService.Find(ID); var notice = CompanyNoticeService.GetALL().SingleOrDefault(x => x.ID == noticeId && x.Status >= (int)CompanyNoticeStatus.ShowOnLine); if (company == null || notice == null) { return(HttpNotFound()); } CompanyIndexViewModel model = new CompanyIndexViewModel(); model.BannerImg = company.BannerImg; model.LogoImg = company.LogoImg; model.ID = company.MemberID; model.Name = company.Name; var cityIds = Utilities.GetIdList(company.CityCodeValue); var cityName = string.Join(" - ", CityCateService.GetALL() .Where(x => cityIds.Contains(x.ID)) .ToList().Select(x => x.CateName)); model.CityName = cityName; model.Description = company.Description; model.LinkMan = company.LinkMan; model.Sex = company.Sex; model.Lat = company.Lat; model.Lng = company.Lng; model.Mobile = company.Mobile; model.Phone = company.Phone; model.QQ = company.QQ; model.Categories = GetCompanyCategorise(ID); model.Notice = notice; return(View(model)); }
public IActionResult Save(CompanyIndexViewModel model) { var UserId = HttpContext.Session.GetString("UserId"); if (ModelState.IsValid) { var company = new Company { Id = model.Id, Description = model.Description, }; if (model.Id.ToString().Length <= 0 || model.Id == 0) { company.CreatedBy = UserId; company.CreationDate = DateTime.Now; _Company.Add(company); } else { company.ModifiedBy = UserId; company.ModifiedDate = DateTime.Now; _Company.Update(company); } return(RedirectToAction("Index")); } else { return(RedirectToAction("Index", model)); } }
// GET: CompaniesController public async Task <IActionResult> Index() { CompanyIndexViewModel companies = new CompanyIndexViewModel(); companies.CompanyList = await _companiesService.All(); return(View(companies)); }
public IActionResult Index() { var result = _Company.Companies().Select ( a => new CompanyViewModel { Id = a.Id, Description = a.Description } ).ToList(); var model = new CompanyIndexViewModel(); model.Companies = result; return(View(model)); }
public async Task <ActionResult> SearchResult(CompanyIndexViewModel data) { if (data.queries == null) { return(View("Index", data)); } else { var postTask = await client.PostAsJsonAsync("/api/Company/Search", data); var UserResult = await postTask.Content.ReadAsAsync <CompanySearchViewModel>(); return(Json(UserResult, JsonRequestBehavior.AllowGet)); } }
public IActionResult Index() { var model = new CompanyIndexViewModel(); model.Items = _dbContext.Companies.Select(r => new CompanyIndexViewModel.Item { Typ = r.CompanyTyp, City = r.Stad, Name = r.Namn, Id = r.Id }).ToList(); return(View(model)); }
public IActionResult Index(string q, bool isDesc, string col, int pageNr = 1) { var viewModel = new CompanyIndexViewModel(); var companySearchResult = _companyRepository.GetSearchResult(q).ToList(); var sortedCompanies = IndexGetSortedCompanyList(companySearchResult, isDesc, col, ref viewModel); viewModel.Companies = IndexGetCompaniesByPageNr(pageNr, sortedCompanies); viewModel.TotalCompanyAmount = companySearchResult.Count; viewModel.CompanyAmountPerPage = _companiesPerPage; viewModel.TotalNumberOfPages = (int)Math.Ceiling(viewModel.TotalCompanyAmount / viewModel.CompanyAmountPerPage); viewModel.SelectedPageNumber = pageNr; viewModel.q = q; return(View(viewModel)); }
public async Task <IActionResult> Index(int id) { var company = _officeManagementService.GetCompany(id); var model = new CompanyIndexViewModel(); // if Image Not Found in the local directory then download from S3 Bucket if (model.CheckAvailabilityFile(company.LogoImageUrl) == false && company.LogoImageUrl != null) { await new CompanyIndexViewModel().DownloadCompanyProfileImageAsync(company.LogoImageUrl); } if (model.CheckAvailabilityFile(company.OfficePhotoUrl) == false && company.OfficePhotoUrl != null) { await new CompanyIndexViewModel().DownloadCompanyOfficePhotoAsync(company.OfficePhotoUrl); } return(View(company)); }
public async Task <IActionResult> Index() { IEnumerable <CompanyIndexServiceModel> companies = await this._companyServices.GetAllCompaniesAsync(); List <CompanyIndexViewModel> model = new List <CompanyIndexViewModel>(); foreach (var cp in companies) { CompanyIndexViewModel company = new CompanyIndexViewModel() { CompanyId = cp.CompanyId, Name = cp.Name, CreationDate = cp.CreationDate.ToString("MM/dd/yyyy"), }; model.Add(company); } return(View(model)); }
public IActionResult AllCompanies() { List <User> Companies = _context.Users.Include("Jobs").Where(u => u.IsCompany == true).OrderByDescending(u => u.CreatedAt).ToList(); ViewBag.Companies = Companies; CompanyIndexViewModel data = new CompanyIndexViewModel(); data.Breadcumb = new BreadcumbViewModel { Title = "Companies", Path = new Dictionary <string, string>() }; data.Breadcumb.Path.Add("index", "Home"); data.Breadcumb.Path.Add("Pages", null); data.Breadcumb.Path.Add("Companies", null); ViewBag.Partial = data.Breadcumb; return(View()); }
public ActionResult show(int ID) { var outdoor = OutDoorLuceneService.Search(ID); if (outdoor.Status < (int)OutDoorStatus.ShowOnline) { return(HttpNotFound()); } var company = CompanyService.Find(outdoor.MemberID); if (company == null || outdoor == null) { return(HttpNotFound()); } CompanyIndexViewModel model = new CompanyIndexViewModel(); model.BannerImg = company.BannerImg; model.LogoImg = company.LogoImg; model.ID = company.MemberID; model.Name = company.Name; var cityIds = Utilities.GetIdList(company.CityCodeValue); var cityName = string.Join(" - ", CityCateService.GetALL() .Where(x => cityIds.Contains(x.ID)) .ToList().Select(x => x.CateName)); model.CityName = cityName; model.Description = company.Description; model.LinkMan = company.LinkMan; model.Sex = company.Sex; model.Lat = company.Lat; model.Lng = company.Lng; model.Mobile = company.Mobile; model.Phone = company.Phone; model.QQ = company.QQ; model.Address = company.Address; model.Categories = GetCompanyCategorise(outdoor.MemberID); model.Links = outdoor; return(View(model)); }
public async Task <ActionResult> Edit(string comp_id) { if (comp_id != null) { CompanyUpdateViewModel model = new CompanyUpdateViewModel(); var postTask = await client.GetAsync("/api/Company/View/?comp_id=" + comp_id); model = await postTask.Content.ReadAsAsync <CompanyUpdateViewModel>(); if (model != null) { return(View("Edit", model)); } else { CompanyIndexViewModel data = new CompanyIndexViewModel(); ViewBag.Error = "No Company Found !"; return(View("Index", data)); } } return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); }
private List <Company> IndexGetSortedCompanyList(IEnumerable <Company> companySearchResult, bool isDesc, string col, ref CompanyIndexViewModel viewModel) { viewModel.IsDescTitle = false; viewModel.IsDescId = false; viewModel.SelectedColumn = col; viewModel.IsDesc = isDesc; if (isDesc && col == "title") { companySearchResult = companySearchResult.OrderByDescending(com => com.Title); } else if (!isDesc && col == "title") { companySearchResult = companySearchResult.OrderBy(com => com.Title); viewModel.IsDescTitle = true; } else if (isDesc && col == "id") { companySearchResult = companySearchResult.OrderByDescending(com => com.Id); } else if (!isDesc && col == "id") { companySearchResult = companySearchResult.OrderBy(com => com.Id); viewModel.IsDescId = true; } return(companySearchResult.ToList()); }
public ActionResult Index() { CompanyIndexViewModel model = new CompanyIndexViewModel(); return(View("Index", model)); }