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)); }
public async Task <ActionResult> DeleteConfirmed(int id) { UserDetailCredentials userDetailCredentials = await db.UserDetailCredentials.FindAsync(id); db.UserDetailCredentials.Remove(userDetailCredentials); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
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)); }
public async Task <IHttpActionResult> GetUserDetailCredentials(int id) { UserDetailCredentials userDetailCredentials = await db.UserDetailCredentials.FindAsync(id); if (userDetailCredentials == null) { return(NotFound()); } return(Ok(userDetailCredentials)); }
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)); }
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)); }
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)); }
// 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)); }
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)); }