i am calling store procedure from MVC, which returns single record only.
SP contains:
PROCEDURE [dbo].[GetMonthlyReport] @emplID INT = NULL,
@month VARCHAR(50) = NULL
AS
BEGIN
IF (@emplID IS NOT NULL AND @month IS NOT NULL) --If Block begins
BEGIN
SELECT *
FROM MonthlyRecord
WHERE Month = @month AND EmplID = @emplID
END --If block ends
ELSE --Else block begins
BEGIN
RETURN 0
END --Else block ends
END
now it is selecting, empID, Overtime, Month, TotalDuration from MonthlyRecord View,
What i want to do is to put these fields in custom template e.g. HTML TABLE or List, like :
<table style="width:300px">
<tr>
<td>Employee ID</td>
<td>Month</td>
</tr>
<tr>
<td>@empID</td>
<td>@Month</td>
</tr>
</table>
something dynamic.
MVC Code:
Controller:
public ActionResult Generated_PaySlip(int? emplID, String month)
{
IEnumerable<GetMonthlyReportResult> PaySlip = DataContext.GetMonthlyReport(emplID, month).ToList();
return View(PaySlip);
}
View:
@using EmployeeAttendance_app.Models
<h2>Employee Pay Slip</h2>
<table style="width:300px">
<tr>
<td>Employee ID</td>
<td>Month</td>
</tr>
<tr>
<td>@empID</td>
<td>@Month</td>
</tr>
</table>