Пример #1
0
        public async Task InsertADMasterReportingHead(ADMasterReportingHead objADMasterReportingHead)
        {
            try
            {
                _Context.ADMasterReportingHeads.Add(objADMasterReportingHead);

                await _Context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Пример #2
0
        public async Task UpdateADMasterReportingHead(ADMasterReportingHead objADMasterReportingHead)
        {
            try
            {
                _Context.Entry(objADMasterReportingHead).State = Microsoft.EntityFrameworkCore.EntityState.Modified;

                await _Context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Пример #3
0
        public async Task DeleteADMasterReportingHead(long MasterReportingHeadId)
        {
            try
            {
                ADMasterReportingHead objADMasterReportingHead = _Context.ADMasterReportingHeads.Find(MasterReportingHeadId);
                _Context.ADMasterReportingHeads.Remove(objADMasterReportingHead);

                await _Context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        public async Task <ActionResult <MasterReportingHeadResult> > PutADMasterReportingHead(long id, ADMasterReportingHead objADMasterReportingHead)
        {
            if (id != objADMasterReportingHead.MasterReportingHeadId)
            {
                return(BadRequest());
            }


            try
            {
                await _IMasterReportingHeadInterface.UpdateADMasterReportingHead(objADMasterReportingHead);

                return(_IMasterReportingHeadInterface.GetADMasterReportingHeadByID(id));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!_IMasterReportingHeadInterface.ADMasterReportingHeadExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(NoContent());
        }
        public async Task <ActionResult <MasterReportingHeadResult> > PostADMasterReportingHead(ADMasterReportingHead objADMasterReportingHead)
        {
            try
            {
                await _IMasterReportingHeadInterface.InsertADMasterReportingHead(objADMasterReportingHead);

                return(CreatedAtAction("GetADMasterReportingHead", new { id = objADMasterReportingHead.MasterReportingHeadId }, objADMasterReportingHead));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }