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

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

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

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

            return(NoContent());
        }
Example #2
0
        public async Task <IActionResult> Postamenity_types([FromBody] amenity_types amenity_types)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.amenity_types.Add(amenity_types);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("Getamenity_types", new { id = amenity_types.id }, amenity_types));
        }