public async Task <FileResult> GenerateWarningeport([FromBody] CreateOrEditEmployeeWarningDto input) { var wariningModel = new EmployeeWarningReportPrint(); wariningModel.WarningName = _warningTypesAppService.GetWarningTypeForView(input.WarningTypeId.Value).Result.WarningType.NameAr; wariningModel.FromDate = input.FromDate; wariningModel.ToDate = input.ToDate; string cusomtSwitches = string.Format("--header-html \"{0}\" --footer-center \" Created Date: " + DateTime.Now.Date.ToString("dd/MM/yyyy") + " Page: [page]/[toPage]\"" + " --footer-line --footer-font-size \"12\" --footer-spacing 1 --footer-font-name \"Segoe UI\"", Url.Action("Header", "Report", new HeaderModel { ReportName = "الهيئة العامة لشئون ذوي الإعاقة" }, "https")); var report = new ViewAsPdf("WarningReport") { PageMargins = { Left = 5, Bottom = 20, Right = 5, Top = 30 }, Model = wariningModel, PageSize = Rotativa.AspNetCore.Options.Size.A4, CustomSwitches = cusomtSwitches }; var bytes = await report.BuildFile(this.ControllerContext); return(File(bytes, "application/pdf", "test.pdf")); }
protected virtual async Task Create(CreateOrEditEmployeeWarningDto input) { var employeeWarning = ObjectMapper.Map <EmployeeWarning>(input); await _employeeWarningRepository.InsertAsync(employeeWarning); }
public async Task CreateOrEdit(CreateOrEditEmployeeWarningDto input) { if (input.Id == null) { await Create(input); } else { await Update(input); } }
protected virtual async Task Update(CreateOrEditEmployeeWarningDto input) { var employeeWarning = await _employeeWarningRepository.FirstOrDefaultAsync((int)input.Id); ObjectMapper.Map(input, employeeWarning); }