Exemple #1
0
        public async Task <IActionResult> PutMstMagazineSection([FromRoute] int id, [FromBody] MstMagazineSection mstMagazineSection)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != mstMagazineSection.MagazineSectionId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #2
0
        public async Task <IActionResult> PostMstMagazineSection([FromBody] MstMagazineSection mstMagazineSection)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.MstMagazineSection.Add(mstMagazineSection);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetMstMagazineSection", new { id = mstMagazineSection.MagazineSectionId }, mstMagazineSection));
        }