/// <summary> /// 更新自選資料 /// </summary> /// <param name="request"></param> public async Task <Response <string> > UpdateOptional(OptionalUpdateRequest request) { using (IUnitOfWork uow = _unitOfWorkManager.Begin()) { uow.BeginTransaction(); Optionals optional = uow.OptionalsRepository.Get(request.OptionalID); optional.Tag = request.Tag; optional.Remark = request.Remark; bool isSuccess = uow.OptionalsRepository.Update(optional, uow.DbTransaction); if (isSuccess) { uow.Commit(); return(new Response <string>("", "success")); } uow.Rollback(); return(new Response <string>("fail")); } }
public async Task <IActionResult> UpdateOptional([FromBody] OptionalUpdateRequest request) { return(Ok(await _optionalService.UpdateOptional(request))); }