public async Task <IActionResult> OnPostAsync() {
var files = Documents;
var purchaseOrder = PurchaseOrder;
purchaseOrder.StatusName = _settings.StatusSetting.Open;
//Validate
var validateResult = purchaseOrder.Validate();
if (!validateResult.IsSuccess) {
throw new UserFriendlyException("Model is not valid");
}
foreach(var fileExtension in files) {
if (!fileExtension.ContentType.Contains("pdf") && !fileExtension.ContentType.Contains("doc") && !fileExtension.ContentType.Contains("docx") && !fileExtension.ContentType.Contains("msword")) {
throw new UserFriendlyException("File is not in valid format");
}
}
var result = await _purchaseOrdersAppService.CreateAsync(PurchaseOrder);
if (files != null && files.Count() > 0) {
foreach(var file in files) {
var documentsPath = _blobStorage.UplodPurchaseOrderFile(file, result.Id).Result;
var documentInput = new DocumentCreateDto {
FileName = file.FileName,
FilePath = documentsPath,
FileSize = (int) file.Length,
FileType = file.ContentType,
RecordId = result.Id,
TypeName = _settings.DocTypeSetting.PurchaseOrder
};
await _documentAppService.CreateAsync(documentInput);
}
}
return Redirect("/PurchaseOrders");
}
Thanks..Working fine!
Hi berkansasmaz,
As u mentioned ,we already add one extra property ADDRESS to organization unit
Now we want to add navigation property STATE to ORGANIZATION UNIT
I referred this ticket https://support.abp.io/QA/Questions/295/Extending-Abp-entities-by-adding-navigation-properties to add STATE to ORGANIZATION UNIT
2021-09-30 14:55:57.166 +05:30 [INF] Request starting HTTP/2 GET https://localhost:44395/Identity/OrganizationUnits/CreateModal - - 2021-09-30 14:55:57.198 +05:30 [INF] Authorization was successful. 2021-09-30 14:55:57.199 +05:30 [INF] Executing endpoint '/Identity/OrganizationUnits/CreateModal' 2021-09-30 14:55:57.204 +05:30 [INF] Route matched with {page = "/Identity/OrganizationUnits/CreateModal", action = "", controller = "", area = ""}. Executing page /Identity/OrganizationUnits/CreateModal 2021-09-30 14:55:57.204 +05:30 [INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy 2021-09-30 14:55:57.212 +05:30 [INF] Executing handler method CustomApp.Web.Pages.Identity.OrganizationUnits.CreateModalModel.OnGetAsync - ModelState is "Valid" 2021-09-30 14:55:57.221 +05:30 [INF] Start processing HTTP request GET "https://localhost:44356/api/app/states/state-lookup?SkipCount=0&MaxResultCount=1000&api-version=1.0" 2021-09-30 14:55:57.221 +05:30 [INF] Sending HTTP request GET "https://localhost:44356/api/app/states/state-lookup?SkipCount=0&MaxResultCount=1000&api-version=1.0" 2021-09-30 14:55:57.485 +05:30 [INF] Received HTTP response headers after 263.966ms - 200 2021-09-30 14:55:57.485 +05:30 [INF] End processing HTTP request after 264.1222ms - 200 2021-09-30 14:55:57.502 +05:30 [INF] Executed handler method OnGetAsync, returned result . 2021-09-30 14:55:57.502 +05:30 [INF] Executing an implicit handler method - ModelState is "Valid" 2021-09-30 14:55:57.502 +05:30 [INF] Executed an implicit handler method, returned result Microsoft.AspNetCore.Mvc.RazorPages.PageResult. 2021-09-30 14:55:57.644 +05:30 [INF] Executed page /Identity/OrganizationUnits/CreateModal in 440.066ms 2021-09-30 14:55:57.644 +05:30 [INF] Executed endpoint '/Identity/OrganizationUnits/CreateModal' 2021-09-30 14:55:57.645 +05:30 [INF] Request finished HTTP/2 GET https://localhost:44395/Identity/OrganizationUnits/CreateModal - - - 200 - text/html;+charset=utf-8 479.8264ms 2021-09-30 14:55:57.972 +05:30 [INF] Request starting HTTP/2 GET https://localhost:44395/Themes/Lepton/Global/assets/fonts/poppins-v6-latin-100.woff2 - - 2021-09-30 14:55:57.974 +05:30 [INF] The file /Themes/Lepton/Global/assets/fonts/poppins-v6-latin-100.woff2 was not modified 2021-09-30 14:55:57.974 +05:30 [INF] Request finished HTTP/2 GET https://localhost:44395/Themes/Lepton/Global/assets/fonts/poppins-v6-latin-100.woff2 - - - 304 - font/woff2 1.8371ms 2021-09-30 14:57:00.944 +05:30 [INF] Request starting HTTP/2 POST https://localhost:44395/Identity/OrganizationUnits/CreateModal application/x-www-form-urlencoded;+charset=UTF-8 314 2021-09-30 14:57:00.976 +05:30 [INF] Authorization was successful. 2021-09-30 14:57:00.976 +05:30 [INF] Executing endpoint '/Identity/OrganizationUnits/CreateModal' 2021-09-30 14:57:00.976 +05:30 [INF] Route matched with {page = "/Identity/OrganizationUnits/CreateModal", action = "", controller = "", area = ""}. Executing page /Identity/OrganizationUnits/CreateModal 2021-09-30 14:57:00.976 +05:30 [INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy 2021-09-30 14:57:01.010 +05:30 [INF] Executing handler method CustomApp.Web.Pages.Identity.OrganizationUnits.CreateModalModel.OnPostAsync - ModelState is "Valid" 2021-09-30 14:57:01.041 +05:30 [ERR] ---------- RemoteServiceErrorInfo ---------- { "code": null, "message": "An internal error occurred during your request!", "details": null, "data": {}, "validationErrors": null }
2021-09-30 14:57:01.044 +05:30 [ERR] Missing type map configuration or unsupported mapping.
Mapping types: Object -> OrganizationUnitCreateDto System.Object -> Volo.Abp.Identity.OrganizationUnitCreateDto AutoMapper.AutoMapperMappingException: Missing type map configuration or unsupported mapping.
Mapping types: Object -> OrganizationUnitCreateDto System.Object -> Volo.Abp.Identity.OrganizationUnitCreateDto at lambda_method2159(Closure , Object , OrganizationUnitCreateDto , ResolutionContext ) at Volo.Abp.AutoMapper.AutoMapperAutoObjectMappingProvider.Map[TSource,TDestination](Object source) at Volo.Abp.ObjectMapping.DefaultObjectMapper.AutoMap[TSource,TDestination](Object source) at Volo.Abp.ObjectMapping.DefaultObjectMapper.Map[TSource,TDestination](TSource source) at CustomApp.Web.Pages.Identity.OrganizationUnits.CreateModalModel.OnPostAsync() in E:\Backup\CustomApp\src\CustomApp.Web\Pages\Identity\OrganizationUnits\CreateModal.cshtml.cs:line 56 at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.GenericTaskHandlerMethod.Convert[T](Object taskAsObject) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.GenericTaskHandlerMethod.Execute(Object receiver, Object[] arguments) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync() at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync() 2021-09-30 14:57:01.049 +05:30 [INF] Executing ObjectResult, writing value of type 'Volo.Abp.Http.RemoteServiceErrorResponse'. 2021-09-30 14:57:01.051 +05:30 [INF] Executed page /Identity/OrganizationUnits/CreateModal in 74.9738ms 2021-09-30 14:57:01.051 +05:30 [INF] Executed endpoint '/Identity/OrganizationUnits/CreateModal' 2021-09-30 14:57:01.051 +05:30 [INF] Request finished HTTP/2 POST https://localhost:44395/Identity/OrganizationUnits/CreateModal application/x-www-form-urlencoded;+charset=UTF-8 314 - 500 - application/json;+charset=utf-8 107.1342ms
Hi,
we have added state entity to organization unit by referring this https://support.abp.io/QA/Questions/295/Extending-Abp-entities-by-adding-navigation-properties
Now we want to override organization unit create/edit page to display StateLookupList ?
Yes,when we will meet?