public async Task <IActionResult> Post([FromBody] List <GarmentInternalPurchaseOrderViewModel> ListViewModel) { try { identityService.Username = User.Claims.Single(p => p.Type.Equals("username")).Value; IValidateService validateService = (IValidateService)serviceProvider.GetService(typeof(IValidateService)); foreach (var viewModel in ListViewModel) { validateService.Validate(viewModel); } var ListModel = mapper.Map <List <GarmentInternalPurchaseOrder> >(ListViewModel); await facade.CreateMultiple(ListModel, identityService.Username); Dictionary <string, object> Result = new ResultFormatter(ApiVersion, General.CREATED_STATUS_CODE, General.OK_MESSAGE) .Ok(); return(Created(String.Concat(Request.Path, "/", 0), Result)); } catch (ServiceValidationExeption e) { Dictionary <string, object> Result = new ResultFormatter(ApiVersion, General.BAD_REQUEST_STATUS_CODE, General.BAD_REQUEST_MESSAGE) .Fail(e); return(BadRequest(Result)); } catch (Exception e) { Dictionary <string, object> Result = new ResultFormatter(ApiVersion, General.INTERNAL_ERROR_STATUS_CODE, e.Message) .Fail(); return(StatusCode(General.INTERNAL_ERROR_STATUS_CODE, Result)); } }