Exemple #1
0
        public async Task <IActionResult> PutLoantable(decimal id, Loantable loantable)
        {
            if (id != loantable.KLoan)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #2
0
        public async Task <ActionResult <Loantable> > PostLoantable(Loantable loantable)
        {
            _context.Loantables.Add(loantable);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (LoantableExists(loantable.KLoan))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetLoantable", new { id = loantable.KLoan }, loantable));
        }