// GET: api/CurrentUser public MessagingUser Get() { MessagingUser messagingUser = new MessagingUser(); UserData Userdata = new UserData(); messagingUser = Userdata.GetCurrentUser(); return messagingUser; }
public MessagingUser GetCurrentUser() { MessagingUser messagingUser = new MessagingUser(); try { using (IDbConnection db = new SqlConnection(ConfigurationValues.DeskTopConnection)) { const string query = "SELECT [ID],[UserID],[UserName],[FirstName],[LastName]" + "FROM [Users]" + " where UserName = @UserName"; messagingUser = db.Query<MessagingUser>(query, new { @UserName = Utility.GetUserName() }).Single(); return messagingUser; } } catch (Exception er) { //Exceptions.ExceptionHandling.InsertErrorMessage(er.ToString()); //Exceptions.ExceptionHandling.SendErrorEmail(er.ToString()); return messagingUser; } }