public async Task <IHttpActionResult> updateNation([FromBody] NATIONVM entity) { var result = await addressService.updatetNationAsync(entity); await LogData(null, entity.NATION_ID.ToString()); return(Ok(result)); }
public async Task <IHttpActionResult> addNation([FromBody] NATIONVM entity) { var result = await addressService.insertNationAsync(entity); await LogData(null, result.ToString()); if (result != 0) { return(Ok(true)); } return(Ok(false)); }
public Task <bool> deletetNationAsync(NATIONVM entity) { return(Task.Run(() => { NATIONS nation = new NATIONS(); { nation.NATION_ID = entity.NATION_ID; nation.NATIONALITY_EN_NAME = entity.NATIONALITY_EN_NAME; nation.NATIONALITY_AR_NAME = entity.NATIONALITY_AR_NAME; nation.NATION_AR_NAME = entity.NATION_AR_NAME; nation.NATION_EN_NAME = entity.NATION_EN_NAME; nation.UpdatedBy = entity.UpdatedBy; nation.updatedOn = entity.updatedOn; nation.AddedOn = entity.AddedOn; nation.Disable = entity.Disable; nation.AddedBy = entity.AddedBy; }; nationsRepo.Delete(nation, nation.NATION_ID); return true; })); }
public Task <short> insertNationAsync(NATIONVM entity) { return(Task.Run(() => { NATIONS nation = new NATIONS(); { nation.NATION_ID = entity.NATION_ID; nation.NATIONALITY_EN_NAME = entity.NATIONALITY_EN_NAME; nation.NATIONALITY_AR_NAME = entity.NATIONALITY_AR_NAME; nation.NATION_AR_NAME = entity.NATION_AR_NAME; nation.NATION_EN_NAME = entity.NATION_EN_NAME; nation.UpdatedBy = entity.UpdatedBy; nation.updatedOn = entity.updatedOn; nation.AddedOn = entity.AddedOn; nation.Disable = entity.Disable; nation.AddedBy = entity.AddedBy; }; nationsRepo.Add(nation); return nation.NATION_ID; })); }
public async Task <IHttpActionResult> deleteNation([FromBody] NATIONVM entity) { var q = employeeService.getByNationID(entity.NATION_ID); var q1 = companyStoresService.getByNationID(entity.NATION_ID); var q2 = customersService.getByNationID(entity.NATION_ID); var q3 = bankService.getByNationID(entity.NATION_ID); var q4 = addressService.getNationGov(entity.NATION_ID); var q5 = companyBranchesService.getByNationID(entity.NATION_ID); if (q.Count == 0 && q1.Count == 0 && q2.Count == 0 && q3.Count == 0 && q4.Count == 0 && q5.Count == 0) { var result = await addressService.deletetNationAsync(entity); await LogData(null, entity.NATION_ID.ToString()); return(Ok(result)); } else { return(Ok(false)); } //return Ok(await addressService.deletetNationAsync(entity)); }