public async Task <IActionResult> PutResource(long id, Resource resource)
        {
            if (id != resource.Id)
            {
                return(BadRequest());
            }

            _context.Entry(resource).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ResourceExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #2
0
        public async Task <IActionResult> PutAsset(long id, Asset asset)
        {
            if (id != asset.Id)
            {
                return(BadRequest());
            }

            _context.Entry(asset).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AssetExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutCampaignSetting(CampaignSettingDTO CampaignSettingDTO)
        {
            var CampaignSetting = await _context.CampaignSetting.FindAsync(CampaignSettingDTO.Id);

            if (CampaignSetting == null)
            {
                return(NotFound());
            }

            CampaignSetting.UpdateWithDTO(CampaignSettingDTO);

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException) when(!CampaignSettingExists(CampaignSettingDTO.Id))
            {
                return(NotFound());
            }

            return(NoContent());
        }