Example #1
0
        public async Task <IActionResult> PutColor_Flag(int c_id, int f_id, Color_Flag color_Flag)
        {
            if (c_id != color_Flag.Id_color || f_id != color_Flag.Id_flag)
            {
                return(BadRequest());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Color_FlagExists(c_id, f_id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #2
0
        public async Task <ActionResult <Color_Flag> > PostColor_Flag(Color_Flag color_Flag)
        {
            _context.Color_Flag.Add(color_Flag);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (Color_FlagExists(color_Flag.Id_color, color_Flag.Id_flag))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetColor_Flag", new { id = color_Flag.Id_color }, color_Flag));
        }