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> AddUser([FromBody] MTUser data) { MTUser.Save(data.getUserName(), data.getPassword(), data.getEmail()); MTUser newuser = MTUser.getUserByName(data.getUserName()); IDictionary <string, string> user = new Dictionary <string, string>(); user.Add(new KeyValuePair <string, string>("username", newuser.getUserName())); user.Add(new KeyValuePair <string, string>("password", newuser.getPassword())); user.Add(new KeyValuePair <string, string>("email", newuser.getEmail())); user.Add(new KeyValuePair <string, string>("sessionstartdate", newuser.getSessionStartDate())); user.Add(new KeyValuePair <string, string>("normalizedstarttime", newuser.getNormalizedStartTime())); user.Add(new KeyValuePair <string, string>("sessionstarttime", newuser.getSessionStartTime())); user.Add(new KeyValuePair <string, string>("userid", newuser.getUserId().ToString())); return(user); }