public async Task <JsonResult> UpdateContractSection([Required] UpdateTemplateSectionViewModel model) { if (!ModelState.IsValid) { return(JsonModelStateErrors()); } return(await JsonAsync(_service.UpdateContractSectionAsync(model))); }
/// <summary> /// Update section template value /// </summary> /// <param name="model"></param> /// <returns></returns> public virtual async Task <ResultModel> UpdateContractSectionAsync([Required] UpdateTemplateSectionViewModel model) { if (model == null) { return(new InvalidParametersResultModel()); } var sectionRequest = await FindSectionByIdAsync(model.Id); if (!sectionRequest.IsSuccess) { return(sectionRequest.ToBase()); } var section = sectionRequest.Result; section.Name = model.Name; section.TemplateValue = model.TemplateValue; _context.ContractSections.Update(section); return(await _context.PushAsync()); }