public ActionResult RemoveCustomer([FromBody] CustomerAuthenticationData userData) { if (CustomerService.Delete(userData) == 0) { return(BadRequest(new{ message = "Customer Does not Exist" })); } return(Ok(this.CustomerService.Delete(userData))); }
public IActionResult CustomerLogin([FromBody] CustomerAuthenticationData customerData) { Guid _Customer = CustomerService.Authenticate(customerData.UserName, customerData.Password); if (_Customer == new Guid()) { return(BadRequest(new { message = " Username or password is incorrect " })); } TempData["ID"] = _Customer; //return RedirectToAction() return(Ok()); }
public int Delete(CustomerAuthenticationData userData) { foreach (var data in AuthenticationDataList) { if (data.UserName == userData.UserName && data.Password == userData.Password) { foreach (var Customer in CustomerList) { if (Customer.CustomerName == userData.UserName && Customer.Password == userData.Password) { CustomerList.Remove(Customer); AuthenticationDataList.Remove(data); return(1); } } } } return(0); }