shiccorama
Member
- Joined
- Apr 24, 2021
- Messages
- 6
- Programming Experience
- 1-3
I am developing CMS and have a problem to display employee's photo in "details" view as it is dynamic, how to assign a dynamic path to employee's phot
in "details" view :
in "index" view, and it is working BTW ..
in employee's controller :
in "details" view :
HTML:
<div class="mb-3">
<span class="input-group-text" id="basic-addon3" asp-for="Photo_Form"> Your Photo </span>
<img src="@Url.Content(ViewBag.photo_details)" asp-append-version="true" class="img-circle" id="Photo_Form" name="Photo_Name" />
</div>
in "index" view, and it is working BTW ..
HTML:
<td>@item.Id</td>
<td>@item.Name</td>
<td>@item.Salary</td>
<td>@item.Email</td>
<td>@item.HireDate.ToShortDateString()</td>
<td><img src="~/Files/Photos/@item.Photo_Name" width="100" height="100" /></td>
<td><a href="~/Files/Docs/@item.CV_Name" download="download">download content</a></td>
<td>@item.IsActive</td>
<td>@item.Notes</td>
<td>@item.department_nav_prop.DepartmentName</td>
<td>@item.DistrictId</td>
in employee's controller :
region details operation
C#:
[HttpGet]
public IActionResult Details(int id)
{
var rowDetailsData = newEmployeeMirror.Read_By_Id_Func(id);
var convertedToMirror = newIMapper.Map<EmployeeMirror>(rowDetailsData);
//here we need to check mapping :
ViewBag.photo_details = rowDetailsData.Photo_Name;
ViewBag.photo_path = @"~/Files/Photos/@ViewBag.photo_details";
var allDepartments = newDepartmentMirror1.Read_All_Func();
ViewBag.departmentList = new SelectList(allDepartments, "Id", "DepartmentName");
return View(convertedToMirror);
}
Last edited by a moderator: