public string IsAdmin(Guid sessionID) { if (sessionID == null || sessionID.Equals(Guid.Empty)) { Logger.writeEvent("Invalid input while checking if the user is admin"); return(Json.Create_json_response(false, new InvalidInputException())); } if (!newMarketFacade.IsAdmin(sessionID)) { Logger.writeEvent("IsAdmin failed | not admin"); return(Json.Create_json_response(false, new NotAdminException())); } return(Json.Create_json_response(true, true)); }
public string GetUserOrderHistory(Guid sessionID, string username)// UC 6.4 { if (string.IsNullOrWhiteSpace(username) || sessionID == null || sessionID.Equals(Guid.Empty)) { Logger.writeEvent("Invalid input while getting the user " + username + " history"); return(Json.Create_json_response(false, new InvalidInputException())); } if (!newMarketFacade.IsloggedIn(sessionID)) { Logger.writeEvent("GetUserOrderHistory failed | not logged in"); return(Json.Create_json_response(false, new LoggedOutException())); } if (!newMarketFacade.IsRegisteredUser(username)) { Logger.writeEvent("GetUserOrderHistory failed | not a registered user"); return(Json.Create_json_response(false, new NotRegisterdException())); } if (!newMarketFacade.IsAdmin(sessionID)) { Logger.writeEvent("GetUserOrderHistory failed | Not admin"); return(Json.Create_json_response(false, new NotAdminException())); } return(newMarketFacade.GetUserOrderHistory(sessionID, username)); }