public override void LoadFromEntity(Model.Facility entity, IMapper mapper) { base.LoadFromEntity(entity, mapper); Name = entity.Name; Description = entity.Description; if (entity.Site != null) { Site = mapper.Map <Model.Site, SiteDto>(entity.Site); } //if (entity.Location != null) // Location = DbGeography.FromText(entity.Location.AsText()); }
public override void LoadFromEntity(Model.Facility entity) { base.LoadFromEntity(entity); Name = entity.Name; Description = entity.Description; Images = entity.Images; if (entity.Site != null) { Site = Mapper.Map <Model.Site, SiteDto>(entity.Site); } if (entity.Location != null) { Location = DbGeography.FromText(entity.Location.AsText()); } }
// GET: Facility/Edit/5 //[HttpPost] //[ValidateAntiForgeryToken] public ActionResult DownloadFacility(string clientCode) { FacilityReport facilityReport = new FacilityReport(); ApplicationUnit unit = new ApplicationUnit(); Model.Facility dbFacility = unit.Facilities.GetAll() .Include(b => b.Buildings) .Include(d => d.DeedsInfo) .Include(c => c.Portfolio) .Include(p => p.ResposiblePerson) .Include("Location.GPSCoordinates") .Include("Location.BoundryPolygon") .Where(f => f.ClientCode.ToLower() == clientCode.ToLower()).FirstOrDefault(); if (dbFacility == null) { return(RedirectToAction("Index")); } Model.OriginalData dbOriginalData = unit.OriginalDatas.GetAll() .Where(o => o.VENUS_CODE.Trim().ToLower() == dbFacility.ClientCode.Trim().ToLower()) .FirstOrDefault(); string filePath = facilityReport.GenerateFacilityReport(dbFacility, dbOriginalData); using (var webClient = new WebClient()) { if (!System.IO.File.Exists(filePath)) { return(null); } byte[] file = webClient.DownloadData(filePath); DeleteAllFile(); return(File(file, MediaTypeNames.Application.Pdf)); } }