public async Task <IHttpActionResult> update([FromBody] UNITSVM entity) { var result = await unitsService.UpdateAsync(entity); await LogData(entity.UNIT_CODE, entity.UNIT_ID.ToString()); return(Ok(result)); }
public async Task <IHttpActionResult> add([FromBody] UNITSVM entity) { var result = await unitsService.InsertAsync(entity); await LogData(entity.UNIT_CODE, result.ToString()); if (result != 0) { return(Ok(true)); } return(Ok(false)); }
public async Task <IHttpActionResult> delete([FromBody] UNITSVM entity) { var q = unitsItems.getByItemunits(entity.UNIT_ID); if (q.Count == 0) { var result = await unitsService.DeleteAsync(entity); await LogData(entity.UNIT_CODE, entity.UNIT_ID.ToString()); return(Ok(result)); } else { return(Ok(false)); } //return Ok(await unitsService.DeleteAsync(entity)); }
public bool Update(UNITSVM entity) { UNITS ig = new UNITS { UNIT_AR_NAME = entity.UNIT_AR_NAME, UNIT_CODE = entity.UNIT_CODE, UNIT_EN_NAME = entity.UNIT_EN_NAME, UNIT_ID = entity.UNIT_ID, UNIT_REMARKS = entity.UNIT_REMARKS, AddedBy = entity.AddedBy, AddedOn = entity.AddedOn, Disable = entity.Disable, UpdatedBy = entity.UpdatedBy, UpdatedOn = entity.UpdatedOn }; unitsRepo.Update(ig, ig.UNIT_ID); return(true); }
public Task <bool> UpdateAsync(UNITSVM entity) { return(Task.Run <bool>(() => { UNITS ig = new UNITS { UNIT_AR_NAME = entity.UNIT_AR_NAME, UNIT_CODE = entity.UNIT_CODE, UNIT_EN_NAME = entity.UNIT_EN_NAME, UNIT_ID = entity.UNIT_ID, UNIT_REMARKS = entity.UNIT_REMARKS, AddedBy = entity.AddedBy, AddedOn = entity.AddedOn, Disable = entity.Disable, UpdatedBy = entity.UpdatedBy, UpdatedOn = entity.UpdatedOn }; unitsRepo.Update(ig, ig.UNIT_ID); return true; })); }
public Task <int> InsertAsync(UNITSVM entity) { return(Task.Run <int>(() => { UNITS ig = new UNITS { UNIT_AR_NAME = entity.UNIT_AR_NAME, UNIT_CODE = entity.UNIT_CODE, UNIT_EN_NAME = entity.UNIT_EN_NAME, UNIT_ID = entity.UNIT_ID, UNIT_REMARKS = entity.UNIT_REMARKS, AddedBy = entity.AddedBy, AddedOn = entity.AddedOn, Disable = entity.Disable, UpdatedBy = entity.UpdatedBy, UpdatedOn = entity.UpdatedOn }; unitsRepo.Add(ig); return ig.UNIT_ID; })); }