Вот мое мнение:
@model IEnumerable<TSICompanyDashboard.Models.tblValuationVechicleImage>
@{
Layout = null;
}
VALUATION REPORT OF VEHICLE
</div>
<div class="text-center" style="font-size:20px;">
(CONFIDENTIAL FOR EXCLUSIVE USE OF @Html.DisplayFor(model => model.tblValuationVechJob.tblBank.BankName)
</div>
<div class="row" style="background-color:lightgrey; font-weight:bold;">
<div class="col-md-3">Date: @DateTime.Now.ToShortDateString()</div>
<div class="col-md-6">Report No: @Html.DisplayNameFor(model => model.tblValuationVechJob.tblCity.CityName)/@Html.DisplayNameFor(model => model.tblValuationVechJob.ReportType)/@Html.DisplayNameFor(model => model.tblValuationVechJob.tblBank.BankCode)/@Html.DisplayNameFor(model => model.tblValuationVechJob.tblCustomer.Code)/@Html.DisplayNameFor(model => model.tblValuationVechJob.Id)/2020</div>
</div>
@{
int groupings = 2;
var grouped = Model.Select((x, i) => new { x, i = i / groupings })
.GroupBy(x => x.i, x => x.x);
}
<table id="memberlist" class="table" >
<tbody>
@foreach (var items in grouped )
{
<tr>
@foreach (var item in items)
{
<td class="col-lg-6 text-center"><img src="@Url.Content(item.Image)" height="400" width="400" /><br />(@item.ImageType)</td>
}
</tr>
}
</tbody>
</table>
<p style="font-size:15px; font-weight:bold;">FOR: TRISTAR INTERNATIONAL CONSULTANT (PVT.) LTD</p>
<br /><br /><br /><br />
<p style="font-size:15px; font-weight:bold;"> __________________________<br />Authorized Signature</p>
</div>
</body>
</html>
А вот мой контроллер:
using Rotativa.MVC;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using TSICompanyDashboard.Models;
namespace TSICompanyDashboard.Controllers
{
public class ValuationVehicleImageController : Controller
{
private TSIDellEntities db = new TSIDellEntities();
public ActionResult ImageReport(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
var tblValVechimg = db.tblValuationVechicleImages.SqlQuery("select * from tblValuationVechicleImage where ValuationVechicJobId=" +id);
if (tblValVechimg == null)
{
return HttpNotFound();
}
var report = new PartialViewAsPdf("~/Views/ValuationVehicleImage/ImageReport.cshtml", tblValVechimg);
return report;
}
}
и
namespace TSICompanyDashboard.Models
{
using System;
using System.Collections.Generic;
using System.Web;
public partial class tblValuationVechicleImage
{
public int Id { get; set; }
public Nullable<int> ValuationVechicJobId { get; set; }
public string ImageType { get; set; }
public string Image { get; set; }
public Nullable<bool> Active { get; set; }
public HttpPostedFileBase ImageFile { get; set; }
public virtual tblValuationVechJob tblValuationVechJob { get; set; }
}
}
Как я могу этого добиться:
введите описание изображения здесь
введите описание изображения здесь
У меня есть связь с таблицами bank-> ValJob-> ValImage
Я новичок в этом форуме и MVC заранее спасибо