Example #1
0
        public async Task <IActionResult> PostBMouldPropertyDetail([FromBody] BMouldPropertyDetail bMouldPropertyDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.BMouldPropertyDetail.Add(bMouldPropertyDetail);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetBMouldPropertyDetail", new { id = bMouldPropertyDetail.Id }, bMouldPropertyDetail));
        }
Example #2
0
        public async Task <IActionResult> PutBMouldPropertyDetail([FromRoute] int id, [FromBody] BMouldPropertyDetail bMouldPropertyDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(NoContent());
        }