public async Task <dynamic> Execute(ContextDto context) { try { init(); validate(); var repo = new TamUngRepository(context); if (_TamUng != null) { var tamungEntity = new Entity.MSSQL_QLDN_QLNS.Entity.TamUng(); tamungEntity.TamUngId = _TamUng.TamUngId; tamungEntity.CtrVersion = _TamUng.CtrVersion; tamungEntity.XoaYN = "Y"; tamungEntity = await repo.UpdatePartial(tamungEntity, nameof(Entity.MSSQL_QLDN_QLNS.Entity.TamUng.XoaYN) ); _TamUng.XoaYN = tamungEntity.XoaYN; } else { if (_listTamUng != null && _listTamUng.Count > 0) { foreach (var tamungModel in _listTamUng) { if (tamungModel.TamUngId > 0) { var tamungEntity = new Entity.MSSQL_QLDN_QLNS.Entity.TamUng(); tamungEntity.TamUngId = tamungModel.TamUngId; tamungEntity.CtrVersion = tamungModel.CtrVersion; tamungEntity.XoaYN = "Y"; tamungEntity = await repo.UpdatePartial(tamungEntity, nameof(Entity.MSSQL_QLDN_QLNS.Entity.TamUng.XoaYN) ); tamungModel.XoaYN = tamungEntity.XoaYN; } } } } return(ActionHelper.returnActionResult(HttpStatusCode.OK, _listTamUng, null)); } catch (FormatException ex) { return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.Message)); } catch (Exception ex) { return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.Message)); } }
public async Task <dynamic> Execute(ContextDto context) { try { dynamic result = new System.Dynamic.ExpandoObject(); var repo = new TamUngRepository(context); await repo.UpdatePartial(this, nameof(NhanVienId), nameof(So), nameof(Ngay), nameof(Tien), nameof(BangChu), nameof(LyDo), nameof(MaTrangThai) ); result.data = this; InsertLuocSuAction ls = new InsertLuocSuAction(); ls.InsertLuocSu(context, "TamUng", TamUngId, "Update", NguoiTao); return(returnActionResult(this, null)); } catch (FormatException ex) { return(returnActionError(HttpStatusCode.BadRequest, ex.Message)); } catch (Exception ex) { return(returnActionError(HttpStatusCode.InternalServerError, ex.Message)); } }