示例#1
0
        public async Task <ActionResult <MasterTaxResult> > PutADMasterTax(long id, ADMasterTax objADMasterTax)
        {
            if (id != objADMasterTax.MasterTaxId)
            {
                return(BadRequest());
            }


            try
            {
                await _IMasterTaxInterface.UpdateADMasterTax(objADMasterTax);

                return(_IMasterTaxInterface.GetADMasterTaxByID(id));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!_IMasterTaxInterface.ADMasterTaxExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(NoContent());
        }
示例#2
0
        public async Task <ActionResult <MasterTaxResult> > PostADMasterTax(ADMasterTax objADMasterTax)
        {
            try
            {
                await _IMasterTaxInterface.InsertADMasterTax(objADMasterTax);

                return(CreatedAtAction("GetADMasterTax", new { id = objADMasterTax.MasterTaxId }, objADMasterTax));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
示例#3
0
        public async Task InsertADMasterTax(ADMasterTax objADMasterTax)
        {
            try
            {
                _Context.ADMasterTaxes.Add(objADMasterTax);

                await _Context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
示例#4
0
        public async Task UpdateADMasterTax(ADMasterTax objADMasterTax)
        {
            try
            {
                _Context.Entry(objADMasterTax).State = Microsoft.EntityFrameworkCore.EntityState.Modified;

                await _Context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
示例#5
0
        public async Task DeleteADMasterTax(long MasterTaxId)
        {
            try
            {
                ADMasterTax objADMasterTax = _Context.ADMasterTaxes.Find(MasterTaxId);
                _Context.ADMasterTaxes.Remove(objADMasterTax);

                await _Context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }