コード例 #1
0
        public async Task <IHttpActionResult> PutUserDetailCredentials(int id, UserDetailCredentials userDetailCredentials)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            db.Entry(userDetailCredentials).State = EntityState.Modified;

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            UserDetailCredentials userDetailCredentials = await db.UserDetailCredentials.FindAsync(id);

            db.UserDetailCredentials.Remove(userDetailCredentials);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
コード例 #3
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Username,Password,Name")] UserDetailCredentials userDetailCredentials)
        {
            if (ModelState.IsValid)
            {
                db.Entry(userDetailCredentials).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(userDetailCredentials));
        }
コード例 #4
0
        public async Task <IHttpActionResult> GetUserDetailCredentials(int id)
        {
            UserDetailCredentials userDetailCredentials = await db.UserDetailCredentials.FindAsync(id);

            if (userDetailCredentials == null)
            {
                return(NotFound());
            }

            return(Ok(userDetailCredentials));
        }
コード例 #5
0
        public async Task <IHttpActionResult> UserDetailsLogin(string username, string password)
        {
            UserDetailCredentials login =
                await db.UserDetailCredentials.Where(x => x.Username == username && x.Password == password).SingleOrDefaultAsync();

            if (login == null)
            {
                return(NotFound());
            }
            return(Ok(login));
        }
コード例 #6
0
        public async Task <ActionResult> Create([Bind(Include = "Id,Username,Password,Name")] UserDetailCredentials userDetailCredentials)
        {
            if (ModelState.IsValid)
            {
                db.UserDetailCredentials.Add(userDetailCredentials);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(userDetailCredentials));
        }
コード例 #7
0
        public async Task <IHttpActionResult> PostUserDetailCredentials(UserDetailCredentials userDetailCredentials)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.UserDetailCredentials.Add(userDetailCredentials);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = userDetailCredentials.Id }, userDetailCredentials));
        }
コード例 #8
0
        // GET: UserDetailCredentials/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            UserDetailCredentials userDetailCredentials = await db.UserDetailCredentials.FindAsync(id);

            if (userDetailCredentials == null)
            {
                return(HttpNotFound());
            }
            return(View(userDetailCredentials));
        }
コード例 #9
0
        public async Task <IHttpActionResult> DeleteUserDetailCredentials(int id)
        {
            UserDetailCredentials userDetailCredentials = await db.UserDetailCredentials.FindAsync(id);

            if (userDetailCredentials == null)
            {
                return(NotFound());
            }

            db.UserDetailCredentials.Remove(userDetailCredentials);
            await db.SaveChangesAsync();

            return(Ok(userDetailCredentials));
        }