public ActionResult Login(LoginLoginModel id) { //Get the customer's UUID, preferably in the future, instead of passing email addresses in, //We'll pass the UUID, or an Access Token SelectCustomerModel customerData = new SelectCustomerModel() { Email = id.email }; CustomerResultModel customerResult = customerTable.SelectRecord(customerData); //Check to see if the customer exists if (customerResult.CustomerUUID == null) { return(Json(new { result = "Fail", reason = "Invalid Credentials" })); } //Verify and report accordingly bool verifyHash = Password.VerifyHash(id.password, customerResult.Hash); if (verifyHash) { return(Json(new { result = "Success" })); } else { return(Json(new { result = "Fail", reason = "Invalid Credentials" })); } }
public ActionResult BrowseApiFindViableItems(EbayBrowseAPIModel data) { SelectCustomerModel customerData = new SelectCustomerModel() { Email = data.email }; CustomerResultModel customerResult = customerTable.SelectRecord(customerData); if (customerResult.CustomerUUID == null) { return(Json(new { result = "Fail", reason = "Invalid Customer" })); } QueryResultModel queryPref = queryTable.SelectRecord(new SelectQueryModel() { CustomerUUID = customerResult.CustomerUUID }); return(Json(BrowseAPI.ItemSummarySearch(queryPref.CategoryID, queryPref.PriceLimit))); }
public ActionResult GetSettings(QueryGetSettingsModel data) { SelectCustomerModel customerData = new SelectCustomerModel() { Email = data.email }; CustomerResultModel customerResult = customerTable.SelectRecord(customerData); if (customerResult.CustomerUUID == null) { return(Json(new { result = "Fail", reason = "Invalid Customer" })); } QueryResultModel queryData = queryTable.SelectRecord(new SelectQueryModel() { CustomerUUID = customerResult.CustomerUUID }); return(Json(new { result = queryData })); }
public ActionResult UpdateAddress(PreferenceAddressModel data) { SelectCustomerModel customerData = new SelectCustomerModel() { Email = data.email }; CustomerResultModel customerResult = customerTable.SelectRecord(customerData); if (customerResult.CustomerUUID == null) { return(Json(new { result = "Fail", reason = "Invalid Customer" })); } UpdateAddressModel customerAddress = new UpdateAddressModel() { CustomerUUID = customerResult.CustomerUUID, BillingAddress = data.streetName, BillingAddress2 = data.streetName2, BillingCity = data.city, BillingState = data.state, BillingZip = data.postalCode, ShippingAddress = data.streetName, ShippingAddress2 = data.streetName2, ShippingCity = data.city, ShippingState = data.state, ShippingZip = data.postalCode }; NonQueryResultModel updateResult = addressTable.UpdateRecord(customerAddress); if (updateResult.Success) { return(Json(new { result = "Success" })); } else { return(Json(new { result = "Fail", reason = "Database Update Failed" })); } }
public ActionResult GetCustomerOrders(OrderHistoryCustomerDataModel data) { CustomerResultModel customerResult = customerTable.SelectRecord(new SelectCustomerModel() { Email = data.email }); List <CustomerOrderResultModel> orderResults = customerOrderTable.SelectAllRecords(new SelectCustomerOrderModel() { CustomerUUID = customerResult.CustomerUUID }); return(Json(orderResults)); }
public ActionResult GetRecentPurchases(HomeGetRecentPurchaseModel id) { SelectCustomerModel customerData = new SelectCustomerModel() { Email = id.email }; CustomerResultModel customerResult = customerTable.SelectRecord(customerData); if (customerResult.CustomerUUID == null) { return(Json(new { result = "Fail", reason = "Invalid Customer" })); } SelectCustomerOrderModel customerOrderData = new SelectCustomerOrderModel() { CustomerUUID = customerResult.CustomerUUID }; List <CustomerOrderResultModel> orderResults = customerOrderTable.SelectAllRecords(customerOrderData); return(Json(new { result = orderResults })); }