public async Task <int> Edit(EditShareClassInputModel model) { ShareClassPostDto dto = AutoMapperConfig.MapperInstance.Map <ShareClassPostDto>(model); ShareClassForeignKeysDto dtoForeignKey = AutoMapperConfig.MapperInstance.Map <ShareClassForeignKeysDto>(model); await this.SetForeignKeys(dto, dtoForeignKey); var parameters = Deserializer.ImportParameters(EndpointsConstants.ShareClassArea + EndpointsConstants.ActionEdit); var procedure = StringExtensions.BuildProcedure( SqlProcedureDictionary.EditShareClass, parameters); SqlCommand command = this.AssignBaseParameters(dto, procedure, parameters); // Assign particular parameters command.Parameters.AddRange(new[] { new SqlParameter(parameters[26].Name, SqlDbType.Int) { Value = dto.Id }, new SqlParameter(parameters[27].Name, SqlDbType.NVarChar) { Value = dto.CommentArea }, new SqlParameter(parameters[28].Name, SqlDbType.NVarChar) { Value = dto.CommentTitle }, }); await this.sqlManager.ExecuteProcedure(command); return(dto.Id); }
public async Task <int> Edit(EditShareClassInputModel model) { ShareClassPostDto dto = AutoMapperConfig.MapperInstance.Map <ShareClassPostDto>(model); ShareClassForeignKeysDto dtoForeignKey = AutoMapperConfig.MapperInstance.Map <ShareClassForeignKeysDto>(model); await this.SetForeignKeys(dto, dtoForeignKey); SqlCommand command = this.AssignBaseParameters(dto, SqlProcedureDictionary.EditShareClass); // Assign particular parameters command.Parameters.AddRange(new[] { new SqlParameter("@sc_id", SqlDbType.Int) { Value = dto.Id }, new SqlParameter("@comment", SqlDbType.NVarChar) { Value = dto.CommentArea }, new SqlParameter("@comment_title", SqlDbType.NVarChar) { Value = dto.CommentTitle }, new SqlParameter("@sc_shortShareClassName", SqlDbType.NVarChar) { Value = dto.ShareClassName }, }); await this.sqlManager.ExecuteProcedure(command); return(dto.Id); }
public async Task <IActionResult> Edit( [Bind("Id", "InitialDate", "ShareClassName", "CSSFCode", "Status", "FACode", "TACode", "LEICode", "InvestorType", "ShareType ", "CurrencyCode", "CountryIssue", "CountryRisk", "EmissionDate", "InceptionDate", "LastNavDate", "ExpiryDate", "InitialPrice", "AccountingCode", "IsHedged", "IsListed", "BloombergMarket", "BloombergCode", "BloombergId", "ISINCode", "ValorCode", "WKN", "DateBusinessYear", "ProspectusCode", "CommentTitle", "CommentArea", "RecaptchaValue")] EditShareClassInputModel model) { bool doesExistAtDate = await this.service.DoesExistAtDate(model.ShareClassName, model.InitialDate); if (!this.ModelState.IsValid || doesExistAtDate) { if (doesExistAtDate) { this.ShowError(this.sharedLocalizer.GetHtmlString(ErrorMessages.ExistingEntityAtDate)); } this.SetViewDataValues(); return(this.View(model)); } var subFundId = await this.service.Edit(model); var date = DateTimeExtensions.ToWebFormat(model.InitialDate.AddDays(1)); return(this.ShowInfo( this.sharedLocalizer.GetHtmlString(InfoMessages.SuccessfulEdit), EndpointsConstants.RouteDetails + EndpointsConstants.ShareClassArea, new { area = EndpointsConstants.ShareClassArea, id = subFundId, date = date })); }