I am fetching the admin side vacancy in client side
currenty admin side three vacancy available and I am displaying three vacancy in client side
In client side display the three vacancy
problem is there I want to display each vacancy display separate
currently all vacancy display together that is main problem
if no vacancy available admin side then display client side no content available
for example:
what I want to:
- class="row">class="col-md-6">
- //first vacancy data and apply button
class="col-md-6">- //second vacancy data and apply button
- class="row">class="col-md-6">
- //third vacancy data and apply button
class="col-md-6">- //fourth vacancy data and apply button
if no vacancy admin side then below display image
- class="row">
- //@ViewBag.message //here I am fetching controller viewbag message in model means **no content available**
admin side vacancy:
client side vacancy(here I fetch the admin vacancy):
ViewModel
- public class ViewModel
- {
- public Career Career { get; set; }
- public List
Vacancy { get; set; } - [NotMapped]
- public SelectList vacancyselectlist { get; set; }
- }
- public class Career
- {
- [Key]
- public int usercarrerid { get; set; }
- public string useremailid { get; set; }
- public string usercontactno { get; set; }
- public string userresume { get; set; }
- public Nullable<int> vacancyid { get; set; }
- [ForeignKey("vacancyid")]
- public Vacancy vacancy { get; set; }
- }
- public class Vacancy
- {
- public int vacancyid { get; set; }
- public string vacancytitle { get; set; }
- public string vacancyposition { get; set; }
- public string vacancyexperience { get; set; }
- public string vacancyjobdescription { get; set; }
- public string vacancyrequiredskill { get; set; }
- }
Career.cshtml
- @model projectname.Models.ViewModel
- class="container">class="row">class="col-md-6">
"margin-top:150px;"
>Current Job Openings - class="container">"font-size:18px;">
Vacancy Title - @foreach (var carr in Model.Vacancy)
- {
- - @carr.vacancytitle
- }
Vacancy Position - @foreach (var carr in Model.Vacancy)
- {
- - @carr.vacancyposition
- }
Vacancy Experiance - @foreach (var carr in Model.Vacancy)
- {
- - @carr.vacancyexperience
- }
Vacancy Job Description - @foreach (var carr in Model.Vacancy)
- {
- @{
- //here I am removing the dots and add the glyphiicon //split means remove the character
- var dataJobDescription = @carr.vacancyjobdescription.Split('.');
- }
- @for (var i = 0; i < dataJobDescription.Length; i++)
- {
"~/bootstrap-icons-1.0.0/chevron-right.svg" width="20" height="20" />
- @dataJobDescription[i]
- }
- }
Vacancy Required Skill - @foreach (var carr in Model.Vacancy)
- {
- @{
- //here I am removing the dots and add the glyphiicon //split means remove the character
- var dataRequiredSkill = @carr.vacancyrequiredskill.Split('.');
- }
- @for (var i = 0; i < dataRequiredSkill.Length; i++)
- {
"~/bootstrap-icons-1.0.0/chevron-right.svg" width="20" height="20" />
- @dataRequiredSkill[i]
- }
- }
- ="btn btn-success applylink">Apply
HomeController.cs
- [HttpGet]
- public async Task
Career(List _vacancy) - {
- //some code
- HttpResponseMessage responseMessage = client.GetAsync("https://localhost:44325/Home/DisplayVacancyData").Result; //here I am fetching admin side vacancy to client side
- if (responseMessage.IsSuccessStatusCode)
- {
- //some code
- if (_vacancy.Count == 0)
- {
- ViewBag.message = "No content Available"; //if no vacancy avilable in admin side then display client side No content Available
- }
- else
- {
- return View("Career", test);
- }
- }
- return View("Index");
- }
problem is here
- @carr.vacancytitle //problem is here all the data get here need to implement logic
- @carr.vacancyposition //problem is here all the data get here need to implement logic
- @carr.vacancyexperience //problem is here all the data get here need to implement logic
which place to add foreach loop because data is dynamic here can not use for loop
here need to implement foreach loop because data is dynamic not static
please help
Sachin SinghPosted Sep 30, 2020, 12:06 AM
"thumbnail-label"
>@article.Name@article.Description
Sachin SinghPosted Sep 30, 2020, 12:31 AM
-------Posted Sep 30, 2020, 12:01 AM
"thumbnail-label"
>@item.vacancytitle@item.vacancyposition
Sachin SinghPosted Sep 29, 2020, 11:55 PM
"thumbnail-label"
>@item.Name@item.Description
-------Posted Sep 29, 2020, 11:43 PM
-------Posted Sep 29, 2020, 11:25 PM
Sachin SinghPosted Sep 29, 2020, 9:36 AM