コード例 #1
0
        public async Task InsertADMasterTimeZone(ADMasterTimeZone objADMasterTimeZone)
        {
            try
            {
                _Context.ADMasterTimeZones.Add(objADMasterTimeZone);

                await _Context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #2
0
        public async Task UpdateADMasterTimeZone(ADMasterTimeZone objADMasterTimeZone)
        {
            try
            {
                _Context.Entry(objADMasterTimeZone).State = Microsoft.EntityFrameworkCore.EntityState.Modified;

                await _Context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #3
0
        public async Task DeleteADMasterTimeZone(long MasterTimeZoneId)
        {
            try
            {
                ADMasterTimeZone objADMasterTimeZone = _Context.ADMasterTimeZones.Find(MasterTimeZoneId);
                _Context.ADMasterTimeZones.Remove(objADMasterTimeZone);

                await _Context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #4
0
        public async Task <ActionResult <MasterTimeZoneResult> > PutADMasterTimeZone(long id, ADMasterTimeZone objADMasterTimeZone)
        {
            if (id != objADMasterTimeZone.MasterTimeZoneId)
            {
                return(BadRequest());
            }


            try
            {
                await _IMasterTimeZoneInterface.UpdateADMasterTimeZone(objADMasterTimeZone);

                return(_IMasterTimeZoneInterface.GetADMasterTimeZoneByID(id));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!_IMasterTimeZoneInterface.ADMasterTimeZoneExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(NoContent());
        }
コード例 #5
0
        public async Task <ActionResult <MasterTimeZoneResult> > PostADMasterTimeZone(ADMasterTimeZone objADMasterTimeZone)
        {
            try
            {
                await _IMasterTimeZoneInterface.InsertADMasterTimeZone(objADMasterTimeZone);

                return(CreatedAtAction("GetADMasterTimeZone", new { id = objADMasterTimeZone.MasterTimeZoneId }, objADMasterTimeZone));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }