public IHttpActionResult PutNotification(int id, Notification notification)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != notification.NotificationId)
            {
                return(BadRequest());
            }

            db.Entry(notification).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!NotificationExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #2
0
        public IHttpActionResult PutExpressionLog(int id, ExpressionLog expressionLog)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != expressionLog.ExpressionLogId)
            {
                return(BadRequest());
            }

            db.Entry(expressionLog).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ExpressionLogExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutJobPost(int id, JobPost jobPost)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != jobPost.JobPostId)
            {
                return(BadRequest());
            }

            db.Entry(jobPost).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!JobPostExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutSeekerProfile(int id, SeekerProfile seekerProfile)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != seekerProfile.SeekerProfileId)
            {
                return(BadRequest());
            }

            db.Entry(seekerProfile).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SeekerProfileExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #5
0
        public IHttpActionResult PutChatMessage(int id, ChatMessage chatMessage)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != chatMessage.ChatMessageId)
            {
                return(BadRequest());
            }

            db.Entry(chatMessage).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ChatMessageExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public HttpResponseMessage PostNewPosterUser(PosterUserModel jinderPosterUser)
        {
            JinderDBEntities dbContext = new JinderDBEntities();
            var usersTable             = dbContext.JinderUsers;
            var PosterTable            = dbContext.JobPosts;

            HttpResponseMessage message = new HttpResponseMessage();


            JinderUser jinderuser = (from user in usersTable
                                     where user.username == jinderPosterUser.username
                                     select user).FirstOrDefault <JinderUser>();

            if (jinderuser != null)
            {
                message.StatusCode = HttpStatusCode.Conflict;
                return(message);
            }
            else
            {
                JinderUser user = new JinderUser();

                user.FullName    = jinderPosterUser.FullName;
                user.DateOfBirth = jinderPosterUser.DateOfBirth;
                user.Gender      = jinderPosterUser.Gender;
                user.Address     = jinderPosterUser.Address;
                user.UserType    = jinderPosterUser.UserType;
                user.username    = jinderPosterUser.username;
                user.password    = jinderPosterUser.password;


                usersTable.Add(user);
                dbContext.SaveChanges();

                JobPost posterUser = new JobPost();

                posterUser.PosterId       = user.JinderUserId;
                posterUser.Location       = jinderPosterUser.Location;
                posterUser.JobDescription = jinderPosterUser.JobDescription;
                posterUser.RequiredSkills = jinderPosterUser.RequiredSkills;
                posterUser.SalaryRange    = jinderPosterUser.SalaryRange;
                posterUser.OperationHours = jinderPosterUser.OperationHours;

                PosterTable.Add(posterUser);
                dbContext.SaveChanges();

                message.StatusCode = HttpStatusCode.OK;

                return(message);
            }
        }
        public HttpResponseMessage PostNewSeekerUser(SeekerUserModel jinderSeekerUser)
        {
            JinderDBEntities dbContext = new JinderDBEntities();
            var usersTable             = dbContext.JinderUsers;
            var SeekersTable           = dbContext.SeekerProfiles;

            HttpResponseMessage message = new HttpResponseMessage();

            JinderUser jinderuser = (from user in usersTable
                                     where user.username == jinderSeekerUser.username
                                     select user).FirstOrDefault <JinderUser>();

            if (jinderuser != null)
            {
                message.StatusCode = HttpStatusCode.Conflict;
                return(message);
            }
            else
            {
                JinderUser user = new JinderUser();

                user.FullName    = jinderSeekerUser.FullName;
                user.DateOfBirth = jinderSeekerUser.DateOfBirth;
                user.Gender      = jinderSeekerUser.Gender;
                user.Address     = jinderSeekerUser.Address;
                user.UserType    = jinderSeekerUser.UserType;
                user.username    = jinderSeekerUser.username;
                user.password    = jinderSeekerUser.password;


                usersTable.Add(user);
                dbContext.SaveChanges();

                SeekerProfile seekerUser = new SeekerProfile();

                seekerUser.JinderUserId  = user.JinderUserId;
                seekerUser.Certification = jinderSeekerUser.Certification;
                seekerUser.Education     = jinderSeekerUser.Education;
                seekerUser.Experience    = jinderSeekerUser.Experience;
                seekerUser.Skills        = jinderSeekerUser.Skills;

                SeekersTable.Add(seekerUser);
                dbContext.SaveChanges();


                message.StatusCode = HttpStatusCode.OK;

                return(message);
            }
        }
Example #8
0
        public HttpResponseMessage PostNewPosterUser(PosterUserModel jinderPosterUser)
        {
            JinderDBEntities dbContext = new JinderDBEntities();
            var usersTable             = dbContext.JinderUsers;
            var PostersTable           = dbContext.JobPosts;

            HttpResponseMessage message = new HttpResponseMessage();

            //if(usersTable.Find(infoUser.JinderUserId) != null)
            //{
            //    message.StatusCode = HttpStatusCode.Conflict;
            //    message.Content = new StringContent("Username: "******" is already registered");
            //    return message;
            //}

            JinderUser user = new JinderUser();

            user.FullName    = jinderPosterUser.FullName;
            user.DateOfBirth = jinderPosterUser.DateOfBirth;
            user.Gender      = jinderPosterUser.Gender;
            user.Address     = jinderPosterUser.Address;
            user.UserType    = jinderPosterUser.UserType;
            user.username    = jinderPosterUser.username;
            user.password    = jinderPosterUser.password;



            usersTable.Add(user);
            dbContext.SaveChanges();

            JobPost posterUser = new JobPost();

            posterUser.JobPostId      = user.JinderUserId;
            posterUser.JobDescription = jinderPosterUser.JobDescription;
            posterUser.RequiredSkills = jinderPosterUser.RequiredSkills;
            posterUser.SalaryRange    = jinderPosterUser.SalaryRange;
            posterUser.OperationHours = jinderPosterUser.OperationHours;
            posterUser.Location       = jinderPosterUser.Location;

            PostersTable.Add(posterUser);
            dbContext.SaveChanges();

            //message.Content = new StringContent("name " + name);
            //message.Content = new StringContent("user saved");


            return(message);
        }
Example #9
0
        public HttpResponseMessage PostNewSeekerUser(SeekerUserModel jinderSeekerUser)
        {
            JinderDBEntities dbContext = new JinderDBEntities();
            var usersTable             = dbContext.JinderUsers;
            var SeekersTable           = dbContext.SeekerProfiles;

            HttpResponseMessage message = new HttpResponseMessage();

            //if(usersTable.Find(infoUser.JinderUserId) != null)
            //{
            //    message.StatusCode = HttpStatusCode.Conflict;
            //    message.Content = new StringContent("Username: "******" is already registered");
            //    return message;
            //}

            JinderUser user = new JinderUser();

            user.FullName    = jinderSeekerUser.FullName;
            user.DateOfBirth = jinderSeekerUser.DateOfBirth;
            user.Gender      = jinderSeekerUser.Gender;
            user.Address     = jinderSeekerUser.Address;
            user.UserType    = jinderSeekerUser.UserType;
            user.username    = jinderSeekerUser.username;
            user.password    = jinderSeekerUser.password;



            usersTable.Add(user);
            dbContext.SaveChanges();

            SeekerProfile seekerUser = new SeekerProfile();

            seekerUser.JinderUserId  = user.JinderUserId;
            seekerUser.Certification = jinderSeekerUser.Certification;
            seekerUser.Education     = jinderSeekerUser.Education;
            seekerUser.Experience    = jinderSeekerUser.Experience;
            seekerUser.Skills        = jinderSeekerUser.Skills;

            SeekersTable.Add(seekerUser);
            dbContext.SaveChanges();

            //message.Content = new StringContent("name " + name);
            //message.Content = new StringContent("user saved");


            return(message);
        }
Example #10
0
        public HttpResponseMessage PostSwipeAction(SwipeActionDTO swipeAction)
        {
            JinderDBEntities dbContext = new JinderDBEntities();
            var actionsTable           = dbContext.ExpressionLogs;
            var usersTable             = dbContext.JinderUsers;

            HttpResponseMessage message = new HttpResponseMessage();


            JinderUser sourcejinderuser = (from user in usersTable
                                           where user.JinderUserId == swipeAction.SourceUserId
                                           select user).FirstOrDefault <JinderUser>();

            JinderUser targetjinderuser = (from user in usersTable
                                           where user.JinderUserId == swipeAction.TargetUserId
                                           select user).FirstOrDefault <JinderUser>();

            if (swipeAction.SourceUserId == null || swipeAction.TargetUserId == null || swipeAction.IsInterested == null)
            {
                message.StatusCode = HttpStatusCode.BadRequest;
                return(message);
            }
            else
            if (sourcejinderuser == null || targetjinderuser == null)
            {
                message.StatusCode = HttpStatusCode.NotFound;
                return(message);
            }
            else
            {
                ExpressionLog action = new ExpressionLog();

                action.IsInterested = swipeAction.IsInterested;
                action.SourceUserId = swipeAction.SourceUserId;
                action.TargetUserId = swipeAction.TargetUserId;


                actionsTable.Add(action);
                dbContext.SaveChanges();

                message.StatusCode = HttpStatusCode.OK;

                return(message);
            }
        }
        public HttpResponseMessage Post([FromBody] SignupInfo info)
        {
            JinderDBEntities dbContext = new JinderDBEntities();
            var usersTable             = dbContext.JinderUsers;

            JinderUser jinderUser = (from user in usersTable
                                     where user.Username == info.Username
                                     select user).FirstOrDefault <JinderUser>();

            HttpResponseMessage message = new HttpResponseMessage();

            if (jinderUser != null)
            {
                message.StatusCode = HttpStatusCode.Conflict;
                message.Content    = new StringContent("Username: "******" is already registered.");

                return(message);
            }

            JinderUser newUser = new JinderUser();

            newUser.Username    = info.Username;
            newUser.Password    = info.Password;
            newUser.FullName    = info.Fullname;
            newUser.DateOfBirth = info.DateOfBirth;
            newUser.Gender      = info.Gender;
            newUser.Address     = info.Address;
            newUser.UserType    = info.UserType;

            usersTable.Add(newUser);
            dbContext.SaveChanges();


            message.StatusCode = HttpStatusCode.Created;
            return(message);
        }