예제 #1
0
        public async Task <IActionResult> PutRun([FromRoute] int id, [FromBody] Run run)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(NoContent());
        }
예제 #2
0
        //[ValidateAntiForgeryToken]
        public async Task <IActionResult> Create([Bind("Id,Username,Email,Firstname,Lastname,ProfilePicture,Status")] Player playerModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(playerModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(playerModel));
        }
예제 #3
0
        public async Task <IActionResult> Create([Bind("Id,Line1,Line2,City,state,ZipCode")] Address addressModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(addressModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(addressModel));
        }
예제 #4
0
        public async Task <IActionResult> Create(
            [Bind("Id,Username,Email,Firstname,Lastname,Status")] UserModel userModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(userModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(userModel));
        }