public async Task <IActionResult> Update([FromBody] SettingFormCommand command) { var settingForm = await _settingFormRepository.GetByIdAsync(command.Id); settingForm.Update( command.Name, command.Description, command.LayoutId, JsonConvert.SerializeObject(command.Settings)); await _settingFormRepository.CommitAsync(); return(Ok()); }
public async Task <IActionResult> Create([FromBody] SettingFormCommand command) { var spec = SettingFormSpecs.GetByNameSpec(command.Name); var isInvalid = await _settingFormRepository.ExistsAsync(spec); if (isInvalid) { throw new CellException("Setting form name mus be unique"); } var settingForm = command.To <SettingForm>(); _settingFormRepository.Add(new SettingForm( settingForm.Name, settingForm.Description, settingForm.LayoutId, JsonConvert.SerializeObject(command.Settings), settingForm.TableId, settingForm.TableName)); await _settingFormRepository.CommitAsync(); return(Ok()); }