Exemple #1
0
        public async Task <IActionResult> PutClass(int id, Classes classDetail)
        {
            if (id != classDetail.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutAssignment(int id, Assignments assignmentDetails)
        {
            if (id != assignmentDetails.Id)
            {
                return(BadRequest());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AssignmentDetailExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            return(NoContent());
        }
Exemple #3
0
        public async Task <ActionResult <Users> > Register(Users user)
        {
            _context.Users.Add(user);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetById", new { id = user.Id }, user));
        }