public Task <bool> DeleteAsync(CompanyStoresVM entity)
 {
     return(Task.Run <bool>(() =>
     {
         COMPANY_STORES Ct = new COMPANY_STORES
         {
             AddedBy = entity.AddedBy,
             AddedOn = entity.AddedOn,
             COM_BRN_ID = entity.COM_BRN_ID,
             COM_MASTER_STORE_ID = entity.COM_MASTER_STORE_ID,
             COM_PRINTER_NAME = entity.COM_PRINTER_NAME,
             COM_STORE_ADDR_REMARKS = entity.COM_STORE_ADDR_REMARKS,
             COM_STORE_AR_ABRV = entity.COM_STORE_AR_ABRV,
             COM_STORE_AR_NAME = entity.COM_STORE_AR_NAME,
             COM_STORE_CODE = entity.COM_STORE_CODE,
             COM_STORE_EN_ABRV = entity.COM_STORE_EN_ABRV,
             COM_STORE_EN_NAME = entity.COM_STORE_EN_NAME,
             COM_STORE_ID = entity.COM_STORE_ID,
             COM_STORE_REMARKS = entity.COM_STORE_REMARKS,
             Disable = entity.Disable,
             EMP_ID = entity.EMP_ID,
             GOV_ID = entity.GOV_ID,
             NATION_ID = entity.NATION_ID,
             TOWN_ID = entity.TOWN_ID,
             UpdatedBy = entity.UpdatedBy,
             updatedOn = entity.updatedOn,
             VILLAGE_ID = entity.VILLAGE_ID
         };
         companyStoreRepo.Delete(Ct, entity.COM_STORE_ID);
         return true;
     }));
 }
        public bool Update(CompanyStoresVM entity)
        {
            COMPANY_STORES Ct = new COMPANY_STORES
            {
                AddedBy                = entity.AddedBy,
                AddedOn                = entity.AddedOn,
                COM_BRN_ID             = entity.COM_BRN_ID,
                COM_MASTER_STORE_ID    = entity.COM_MASTER_STORE_ID,
                COM_PRINTER_NAME       = entity.COM_PRINTER_NAME,
                COM_STORE_ADDR_REMARKS = entity.COM_STORE_ADDR_REMARKS,
                COM_STORE_AR_ABRV      = entity.COM_STORE_AR_ABRV,
                COM_STORE_AR_NAME      = entity.COM_STORE_AR_NAME,
                COM_STORE_CODE         = entity.COM_STORE_CODE,
                COM_STORE_EN_ABRV      = entity.COM_STORE_EN_ABRV,
                COM_STORE_EN_NAME      = entity.COM_STORE_EN_NAME,
                COM_STORE_ID           = entity.COM_STORE_ID,
                COM_STORE_REMARKS      = entity.COM_STORE_REMARKS,
                Disable                = entity.Disable,
                EMP_ID     = entity.EMP_ID,
                GOV_ID     = entity.GOV_ID,
                NATION_ID  = entity.NATION_ID,
                TOWN_ID    = entity.TOWN_ID,
                UpdatedBy  = entity.UpdatedBy,
                updatedOn  = entity.updatedOn,
                VILLAGE_ID = entity.VILLAGE_ID
            };

            companyStoreRepo.Update(Ct, Ct.COM_STORE_ID);
            return(true);
        }
        public async Task <IHttpActionResult> update([FromBody] CompanyStoresVM entity)
        {
            var result = await companyStoresService.UpdateAsync(entity);

            await LogData(entity.COM_STORE_CODE, entity.COM_STORE_ID.ToString());

            return(Ok(result));
        }
        public async Task <IHttpActionResult> add([FromBody] CompanyStoresVM entity)
        {
            var result = await companyStoresService.InsertAsync(entity);

            await LogData(entity.COM_STORE_CODE, result.ToString());

            if (result != 0)
            {
                return(Ok(true));
            }
            return(Ok(false));
        }
        public async Task <IHttpActionResult> delete([FromBody] CompanyStoresVM entity)
        {
            var q = billMasterService.getBillStores(entity.COM_STORE_ID);

            if (q.Count == 0)
            {
                var result = await companyStoresService.DeleteAsync(entity);
                await LogData(entity.COM_STORE_CODE, entity.COM_STORE_ID.ToString());

                return(Ok(result));
            }

            else
            {
                return(Ok(false));
            }

            //return Ok(await companyStoresService.DeleteAsync(entity));
        }