Exemplo n.º 1
0
        public async Task <HttpResponseMessage> GetLastSeen(BaseRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
            try
            {
                NeeoUser user   = new NeeoUser(request.Uid.Trim());
                var      result = await user.GetLastSeenTimeAsync();

                return(Request.CreateResponse(HttpStatusCode.OK, result));
            }
            catch (ApplicationException applicationException)
            {
                return(Request.CreateErrorResponse((HttpStatusCode)Convert.ToInt16(applicationException.Message), NeeoDictionaries.HttpStatusCodeDescriptionMapper[Convert.ToInt16(applicationException.Message)]));
            }
            catch (Exception exception)
            {
                LogManager.CurrentInstance.ErrorLogger.LogError(
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, exception.Message, exception);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError));
            }
        }