// GET api/default1
        public IEnumerable<User> Get()
        {
            IEnumerable<User> users = new List<User>();
            try
            {
                //List<UserMapper> usersMapper = new List<UserMapper>();
                using (SmarteezDatabaseEntities db = new SmarteezDatabaseEntities())
                {
                    users = db.Users.ToList();
                }

                //foreach (var item in users)
                //{
                //    UserMapper obj = new UserMapper();
                //    obj.UserName = item.UserId;
                //    usersMapper.Add(obj);
                //}
                //UserMapper usersMapper = from users i
                return users;
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message,ex);
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content = new StringContent(ex.Message),
                    ReasonPhrase = "Critical Exception"
                });
            }
        }
        public HttpResponseMessage Get(string LoginId, string Passowrd, string Role)
        {
            List<User> users = new List<User>();
            using (SmarteezDatabaseEntities db = new SmarteezDatabaseEntities())
            {
                users = db.Users.Where(user=>user.UserId == LoginId && user.Passowrd == Passowrd && user.IsActive=="A" && user.Role == Role).ToList();
                if (users==null)
                {
                    return new HttpResponseMessage(HttpStatusCode.NotFound);
                }
            }

            return Request.CreateResponse(HttpStatusCode.OK, users);
        }
        private static void insertUserName(String name, string email, String contact, string query)
        {
            CustomerQuery customerQuery = new CustomerQuery()
            {
                CustomerName = name,
                Email = email,
                IsQueryResponded = "N",
                Message = query,
                MobileNumber = contact,
                QueryResponse = string.Empty,
                QueryResponseDate = null,
                ReceiveDate = DateTime.Now
            };

            using (var dbContext = new SmarteezDatabaseEntities())
            {
                dbContext.CustomerQueries.Add(customerQuery);
                dbContext.SaveChanges();
            }
        }
 void Session_Start(object sender, EventArgs e)
 {
     //Code that runs when a new session is started
     Application.Lock();
     using (var dbContext = new SmarteezDatabaseEntities())
     {
         WebSiteUser websiteUser = new WebSiteUser()
         {
             ClientBrowser = HttpContext.Current.Request.Browser.Browser,
             MachineIP = string.IsNullOrEmpty(HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]) ? HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"] : HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"],
             VisitDate = DateTime.Now
         };
         int i = dbContext.Users.Count();
         dbContext.WebSiteUsers.Add(websiteUser);
         dbContext.SaveChanges();
         int userCount = dbContext.WebSiteUsers.Count<WebSiteUser>() + 1000;
         Application.Add("UserCount", userCount);
     }
     Application.UnLock();
 }