public ActionResult ChangePassword(VM_AccountEmployee vM) { var putTask = client.PutAsJsonAsync <VM_AccountEmployee>("Accounts/" + vM.EmployeeId, vM); putTask.Wait(); return(RedirectToAction("Login")); }
public int Login(VM_AccountEmployee vM) { var spName = "SP_Login"; parameters.Add("@Email", vM.Email); parameters.Add("@Password", vM.Passwords); var result = connection.Query <Int32>(spName, parameters, commandType: CommandType.StoredProcedure); return(result.FirstOrDefault()); }
public int Update(VM_AccountEmployee vM) { var spName = "SP_UpdateAccount"; parameters.Add("@Email", vM.Email); parameters.Add("@Password", vM.Passwords); var result = connection.Execute(spName, parameters, commandType: CommandType.StoredProcedure); return(result); }
public ActionResult Register(VM_AccountEmployee vM) { HttpResponseMessage response = client.PostAsJsonAsync("Accounts", vM).Result; if (response.IsSuccessStatusCode) { return(RedirectToAction("Login")); } return(View()); }
//public IHttpActionResult Get() //{ // var getAll = accountRepository.Get(); // if (getAll != null) // { // return Ok(getAll); // } // return NotFound(); //} public IHttpActionResult Put(VM_AccountEmployee vM) { var UpdateAccount = accountRepository.Update(vM); if (UpdateAccount == 0) { return(BadRequest()); } return(Ok()); }
public IHttpActionResult Post(VM_AccountEmployee vM_AccountEmployee) { var CreateAccount = accountRepository.Create(vM_AccountEmployee); if (CreateAccount == 0) { return(BadRequest()); } return(Ok("data has been inputted")); }
// GET: Login public IHttpActionResult Post(VM_AccountEmployee vM) { var Login = accountRepository.Login(vM); //Login.Wait(); //var temp = Login.Result.ToList(); if (Login == 0) { return(NotFound()); } return(Ok(Login)); }
public int Create(VM_AccountEmployee vM_AccountEmployee) { var spName = "SP_InsertEmployeeAccount"; parameters.Add("@Nama", vM_AccountEmployee.Nama); parameters.Add("@posisi", vM_AccountEmployee.Posisi); parameters.Add("@Email", vM_AccountEmployee.Email); parameters.Add("@PhoneNumber", vM_AccountEmployee.PhoneNumber); parameters.Add("@BirthDate", vM_AccountEmployee.BirthDate); parameters.Add("@Password", vM_AccountEmployee.Passwords); var result = connection.Execute(spName, parameters, commandType: CommandType.StoredProcedure); return(result); }
public ActionResult Login(VM_AccountEmployee vM) { HttpResponseMessage response = client.PostAsJsonAsync("Login/Login", vM).Result; var readTask = response.Content.ReadAsStringAsync(); readTask.Wait(); var respondTask = readTask.Result; var responseTask = client.GetAsync("Employees/"); responseTask.Wait(); var result = responseTask.Result; if (result.IsSuccessStatusCode) { var read = result.Content.ReadAsAsync <IList <Employee> >(); read.Wait(); var id = read.Result.Where(a => a.Email == vM.Email).FirstOrDefault().EmployeeId; return(RedirectToAction("Index", "Employees", new { id })); } return(View()); }