// GET api/<controller>
        public HttpResponseMessage GetAll()
        {
            try
            {
                //new StatusChecker.Hangfire.StatusChecker(@"Data Source=USER-PC\SQLEXPRESS;Initial Catalog=HangfireDb;Integrated Security=False;User Id=sa;Password=sa1234;").GetStatusAsync();
                //// var jobId = _backgroundJobClient.Enqueue(() => LogInTest(new LoginJson()));

                List <PeopleJSON> userJSONList = new PeopleControllerHelper().Map_IncomesDTOList_To_IncomeJSONList(_peopleService.GetAll());
                return(this.Request.CreateResponse(HttpStatusCode.OK, userJSONList));
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
                return(this.Request.CreateResponse(HttpStatusCode.InternalServerError));
            }
        }
Beispiel #2
0
        public IEnumerable <PeopleVM> Get(string query = null)
        {
            IEnumerable <PeopleVM> peoples = null;



            if (string.IsNullOrEmpty(query))

            {
                peoples = new PeopleControllerHelper().MapPeopleDtoToVm(_peopleService.GetPeopleDocuments());
            }

            else
            {
                peoples = new PeopleControllerHelper().MapPeopleDtoToVm(_peopleService.SearchPeopleDocumentsByField("peopletype", query));
            }


            return(peoples);
        }
        public HttpResponseMessage LogIn([FromBody] LoginJson loginJson)
        {
#if DEBUG
            loginJson = new LoginJson()
            {
                EmailId  = "*****@*****.**",
                Password = "******"
            };
#endif
            try
            {
                if (loginJson == null)
                {
                    throw new ArgumentNullException("loginJson");
                }

                if (string.IsNullOrEmpty(loginJson.EmailId))
                {
                    throw new ArgumentNullException("Emaild");
                }

                if (string.IsNullOrEmpty(loginJson.Password))
                {
                    throw new ArgumentNullException("Password");
                }

                PeopleJSON user = new PeopleControllerHelper().Map_PeopleDTO_To_JSON(_peopleService.LogIn(new LoginControllerHelper().Map_LoginJSON_To_DTO(loginJson)));

                return(Request.CreateResponse(HttpStatusCode.OK, user));
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError));
            }
        }