Esempio n. 1
0
        public ActionResult <ResponseModel <List <EventModel> > > GetByCity([FromHeader] string Authorization)
        {
            string token     = Authorization.Split()[1];
            var    eventList = _eventService.GetByToken(token);

            return(ResponseModel <List <EventModel> > .FormResponse("events", eventList, "Unable to get events"));
        }
Esempio n. 2
0
        public ActionResult <ResponseModel <EventModel> > Create(CreateEventRequest eventModel, [FromHeader] string Authorization)
        {
            string token = Authorization.Split()[1];
            var    Event = _eventService.Create(eventModel, token);

            return(ResponseModel <EventModel> .FormResponse("event", Event, "Unable to create event"));
        }
Esempio n. 3
0
        public ActionResult <ResponseModel <List <EventModel> > > GetAllByCurrentDate()
        {
            var eventList = _eventService.GetAllByCurrentDate();

            return(ResponseModel <List <EventModel> > .FormResponse("events", eventList
                                                                    , "Unable to get events"));
        }
        public ActionResult <ResponseModel <UserModel> > Get([FromHeader] string Authorization)
        {
            string token = Authorization.Split()[1];
            var    user  = _userService.Get(token);

            return(ResponseModel <UserModel> .FormResponse("user", user, "User not found"));
        }
        public ActionResult <ResponseModel <string> > UploadImage([FromHeader] string Authorization
                                                                  , UploadImageModel imageModel)
        {
            string token = Authorization.Split()[1];
            string path  = _userService.UploadImage(token, imageModel);

            return(ResponseModel <string> .FormResponse("path", path, "Unable to upload image"));
        }
        public ActionResult <ResponseModel <string> > Login(UserLoginRequest request)
        {
            var authResponse = _identityService.Login(request.Email.ToLower(), request.Password);

            if (!authResponse.Success)
            {
                return(new ResponseModel <string>(null, false, authResponse.Errors));
            }

            _userService.AddUserToken(request.Email.ToLower(), authResponse.Token);

            return(ResponseModel <string> .FormResponse("token", authResponse.Token, null));
        }
        public ActionResult <ResponseModel <string> > Register(UserRegistrationRequest request)
        {
            if (!ModelState.IsValid)
            {
                var errors = ModelState.Values.SelectMany(x => x.Errors.Select(xx => xx.ErrorMessage));
                return(new ResponseModel <string>(null, false, errors));
            }

            var authResponse = _identityService.Register(request.Email.ToLower(), request.Password, request.FirstName
                                                         , request.LastName, request.City);

            if (!authResponse.Success)
            {
                return(new ResponseModel <string>(null, false, authResponse.Errors));
            }

            _userService.AddUserToken(request.Email.ToLower(), authResponse.Token);

            return(ResponseModel <string> .FormResponse("token", authResponse.Token, null));
        }
Esempio n. 8
0
        public ActionResult <ResponseModel <List <EventModel> > > GetByCity(CityModel cityModel)
        {
            var eventList = _eventService.GetByCity(cityModel);

            return(ResponseModel <List <EventModel> > .FormResponse("events", eventList, "Unable to get events"));
        }
        public ActionResult <ResponseModel <CityModel> > Get(string id)
        {
            var city = _cityService.Get(id);

            return(ResponseModel <CityModel> .FormResponse("city", city, "City not found"));
        }
        public ActionResult <ResponseModel <CityModel> > Create(CityModel cityModel)
        {
            var city = _cityService.Create(cityModel);

            return(ResponseModel <CityModel> .FormResponse("city", city, "Unable to create city"));
        }
        public ActionResult <ResponseModel <UserModel> > GetById(string id)
        {
            var user = _userService.GetById(id);

            return(ResponseModel <UserModel> .FormResponse("user", user, "User not found"));
        }
        public ActionResult <ResponseModel <List <CityModel> > > GetAll()
        {
            var cityList = _cityService.GetAll();

            return(ResponseModel <List <CityModel> > .FormResponse("cities", cityList, "Unable to get cities"));
        }
Esempio n. 13
0
        public ActionResult <ResponseModel <List <UserModel> > > GetVisitors(string id)
        {
            var userList = _eventService.GetVisitors(id);

            return(ResponseModel <List <UserModel> > .FormResponse("users", userList, "Unable to get users"));
        }
Esempio n. 14
0
        public ActionResult <ResponseModel <EventModel> > Get(string id)
        {
            var Event = _eventService.Get(id);

            return(ResponseModel <EventModel> .FormResponse("event", Event, "Event not found"));
        }
        public ActionResult <ResponseModel <List <UserModel> > > GetAll()
        {
            var userList = _userService.GetAll();

            return(ResponseModel <List <UserModel> > .FormResponse("users", userList, "Unable to get users"));
        }
        public ActionResult <ResponseModel <List <BackendEventModel> > > GetVisitingEvents(string id)
        {
            var eventList = _userService.GetVisitingEvents(id);

            return(ResponseModel <List <BackendEventModel> > .FormResponse("events", eventList, "Unable to get events"));
        }
        public ActionResult <ResponseModel <UserModel> > Create(BackendUserModel userModel)
        {
            var user = _userService.Create(userModel);

            return(ResponseModel <UserModel> .FormResponse("user", user, "Unable to create user"));
        }