コード例 #1
0
        public IHttpActionResult GetUsers([FromUri] string senderID)
        {
            List <IUser> result = new List <IUser>();

            if (!LoggedUsers.Contains(senderID))
            {
                return(Content(HttpStatusCode.Unauthorized, "Not logged in."));
            }

            //other rights?

            try
            {
                (DbAdmin.GetAll()).ToList().ForEach(a => result.Add(a));
                (DbCustomer.GetAll()).ToList().ForEach(c => result.Add(c));
                (DbDriver.GetAll()).ToList().ForEach(d => result.Add(d));
            }
            catch (Exception e)
            {
                Trace.Write($"Error on 'GetUsers()'. Error message: {e.Message}");
                Trace.Write($"[STACK_TRACE] {e.StackTrace}");
                return(InternalServerError(e));
            }

            return(Ok(result));
        }