public async Task <IHttpActionResult> updateVillage([FromBody] VILLAGEVM entity)
        {
            var result = await addressService.updatetVillageAsync(entity);

            await LogData(null, entity.VILLAGE_ID.ToString());

            return(Ok(result));
        }
        public async Task <IHttpActionResult> addVillage([FromBody] VILLAGEVM entity)
        {
            var result = await addressService.insertVillageAsync(entity);

            await LogData(null, result.ToString());

            if (result != 0)
            {
                return(Ok(true));
            }
            return(Ok(false));
        }
 public Task <bool> deletetVillageAsync(VILLAGEVM entity)
 {
     return(Task.Run(() =>
     {
         VILLAGES village = new VILLAGES();
         {
             village.VILLAGE_ID = entity.VILLAGE_ID;
             village.VILLAGE_EN_NAME = entity.VILLAGE_EN_NAME;
             village.VILLAGE_AR_NAME = entity.VILLAGE_AR_NAME;
             village.TOWN_ID = entity.TOWN_ID;
             village.UpdatedBy = entity.UpdatedBy;
             village.updatedOn = entity.updatedOn;
             village.AddedOn = entity.AddedOn;
             village.Disable = entity.Disable;
             village.AddedBy = entity.AddedBy;
         };
         villageRepo.Delete(village, village.VILLAGE_ID);
         return true;
     }));
 }
 public Task <long> insertVillageAsync(VILLAGEVM entity)
 {
     return(Task.Run(() =>
     {
         VILLAGES village = new VILLAGES();
         {
             village.VILLAGE_ID = entity.VILLAGE_ID;
             village.VILLAGE_EN_NAME = entity.VILLAGE_EN_NAME;
             village.VILLAGE_AR_NAME = entity.VILLAGE_AR_NAME;
             village.TOWN_ID = entity.TOWN_ID;
             village.UpdatedBy = entity.UpdatedBy;
             village.updatedOn = entity.updatedOn;
             village.AddedOn = entity.AddedOn;
             village.Disable = entity.Disable;
             village.AddedBy = entity.AddedBy;
         };
         villageRepo.Add(village);
         return village.VILLAGE_ID;
     }));
 }
        public async Task <IHttpActionResult> deleteVillage([FromBody] VILLAGEVM entity)
        {
            var q  = employeeService.getByVilID(entity.VILLAGE_ID);
            var q1 = companyStoresService.getByVilID(entity.VILLAGE_ID);
            var q2 = customersService.getByVilID(entity.VILLAGE_ID);
            var q3 = bankService.getByVilID(entity.VILLAGE_ID);
            var q4 = companyBranchesService.getByVilID(entity.VILLAGE_ID);

            if (q.Count == 0 && q1.Count == 0 && q2.Count == 0 && q3.Count == 0 && q4.Count == 0)
            {
                var result = await addressService.deletetVillageAsync(entity);
                await LogData(null, entity.VILLAGE_ID.ToString());

                return(Ok(result));
            }

            else
            {
                return(Ok(false));
            }
            //return Ok(await addressService.deletetVillageAsync(entity));
        }