public IDictionary <string, string> UserLogin([FromBody] MTUser data) { int verifiedUser = MTUser.verifyUserLogin(data.getUserName(), data.getPassword()); IDictionary <string, string> user = new Dictionary <string, string>(); if (verifiedUser == 3) { MTUser founduser = MTUser.getUserByName(data.getUserName()); user.Add(new KeyValuePair <string, string>("username", founduser.getUserName())); user.Add(new KeyValuePair <string, string>("password", founduser.getPassword())); user.Add(new KeyValuePair <string, string>("email", founduser.getEmail())); user.Add(new KeyValuePair <string, string>("sessionstartdate", founduser.getSessionStartDate())); user.Add(new KeyValuePair <string, string>("normalizedstarttime", founduser.getNormalizedStartTime())); user.Add(new KeyValuePair <string, string>("sessionstarttime", founduser.getSessionStartTime())); user.Add(new KeyValuePair <string, string>("userid", founduser.getUserId().ToString())); } else { MTUser erroruser = new MTUser("error", "error", "error", "error", "error", "error", 0); user.Add(new KeyValuePair <string, string>("username", erroruser.getUserName())); user.Add(new KeyValuePair <string, string>("password", erroruser.getPassword())); user.Add(new KeyValuePair <string, string>("email", erroruser.getEmail())); user.Add(new KeyValuePair <string, string>("sessionstartdate", erroruser.getSessionStartDate())); user.Add(new KeyValuePair <string, string>("normalizedstarttime", erroruser.getNormalizedStartTime())); user.Add(new KeyValuePair <string, string>("sessionstarttime", erroruser.getSessionStartTime())); user.Add(new KeyValuePair <string, string>("userid", erroruser.getUserId().ToString())); } return(user); }
public IDictionary <string, string> StartSession([FromBody] MTUser data) { MTUser founduser = MTUser.getUserByName(data.getUserName()); founduser.setSessionStartDate(data.getSessionStartDate()); founduser.setNormalizedStartTime(data.getNormalizedStartTime()); founduser.setSessionStartTime(data.getSessionStartTime()); MTUser.startNewSession(founduser.getUserId(), founduser.getSessionStartDate(), founduser.getNormalizedStartTime(), founduser.getSessionStartTime()); IDictionary <string, string> user = new Dictionary <string, string>(); user.Add(new KeyValuePair <string, string>("username", founduser.getUserName())); user.Add(new KeyValuePair <string, string>("password", founduser.getPassword())); user.Add(new KeyValuePair <string, string>("email", founduser.getEmail())); user.Add(new KeyValuePair <string, string>("sessionstartdate", founduser.getSessionStartDate())); user.Add(new KeyValuePair <string, string>("normalizedstarttime", founduser.getNormalizedStartTime())); user.Add(new KeyValuePair <string, string>("sessionstarttime", founduser.getSessionStartTime())); user.Add(new KeyValuePair <string, string>("userid", founduser.getUserId().ToString())); return(user); }