예제 #1
0
        public async Task <ActionResult <propertycharge> > PostPropertyCharge(propertycharge propertycharge)
        {
            _context.propertycharge.Add(propertycharge);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("Getpropertycharge", new { id = propertycharge.propertyChargeId }, propertycharge));
        }
예제 #2
0
        public async Task <IActionResult> PutPropertyCharge(int id, propertycharge propertycharge)
        {
            if (id != propertycharge.propertyChargeId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }