Example #1
0
        public async Task <IActionResult> PutCasaBoxType(string id, CasaBoxType casaBoxType)
        {
            if (id != casaBoxType.Type)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Example #2
0
        public async Task <ActionResult <CasaBoxType> > PostCasaBoxType(CasaBoxType casaBoxType)
        {
            _context.CasaBoxType.Add(casaBoxType);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (CasaBoxTypeExists(casaBoxType.Type))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetCasaBoxType", new { id = casaBoxType.Type }, casaBoxType));
        }