public IHttpActionResult PostLogin_Credentials(Login_Credentials login_Credentials) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Login_Credentials.Add(login_Credentials); try { db.SaveChanges(); } catch (DbUpdateException) { if (Login_CredentialsExists(login_Credentials.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = login_Credentials.Id }, login_Credentials)); }
public IHttpActionResult PutLogin_Credentials(int id, Login_Credentials login_Credentials) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != login_Credentials.Id) { return(BadRequest()); } db.Entry(login_Credentials).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Login_CredentialsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetLogin_Credentials(int id) { Login_Credentials login_Credentials = db.Login_Credentials.Find(id); if (login_Credentials == null) { return(NotFound()); } return(Ok(login_Credentials)); }
public IHttpActionResult DeleteLogin_Credentials(int id) { Login_Credentials login_Credentials = db.Login_Credentials.Find(id); if (login_Credentials == null) { return(NotFound()); } db.Login_Credentials.Remove(login_Credentials); db.SaveChanges(); return(Ok(login_Credentials)); }
public ActionResult Login(Login_Credentials lc) { ObjectParameter output = new ObjectParameter("IsValid", typeof(int)); if (ModelState.IsValid) { RatnoTechEntities1 rt = new RatnoTechEntities1(); var i = rt.Sp_Login(lc.Username, lc.Password, output); if (i == 1) { Session["login"] = 1; return(RedirectToAction("Index", "Home")); } } return(RedirectToAction("Register", "User")); }
public ActionResult Login() { Login_Credentials lc = new Login_Credentials(); return(View(lc)); }