public async Task Put(int id, CinemaUpdateDto value) { //if (!TryValidateModel(value)) //{ // var errorState = ModelState.Select(e => new KeyValuePair<string, string>(e.Key, e.Value.RawValue.ToString())).ToDictionary(e => e.Key, e => e.Value); // throw new InputException(errorState, "输入错误"); //} await CommandBus.SendAsync(new CinemaUpdateCommand { Input = value }); }
public async Task <IActionResult> Edit(int id, CinemaUpdateDto dto) { if (!await TryUpdateModelAsync(dto)) { return(View(dto)); } await CommandBus.SendAsync(new CinemaUpdateCommand() { Input = dto }); this.ModelState.AddModelError(string.Empty, "Success!"); return(View(dto)); }