Ejemplo n.º 1
0
        public ActionResult Create([Bind(Exclude = "ProfileImage")] ProfileModels profile)
        {
            // Excludes ProfileImage from controller call so it doesn't crash.
            if (ModelState.IsValid)
            {
                // Convert the uploaded photo to a byte array that we can store in the database.
                byte[] imageData = null;
                if (Request.Files["ProfileImage"].ContentLength >= 1)   // Check if a file is entered
                {
                    HttpPostedFileBase poImgFile = Request.Files["ProfileImage"];

                    using (var binary = new BinaryReader(poImgFile.InputStream)) {
                        //This is the byte-array we set as the ProfileImage property on the profile.
                        imageData = binary.ReadBytes(poImgFile.ContentLength);
                    }
                }
                else     // If they did not submit a profile image they get the default avatar
                {
                    string     path = AppDomain.CurrentDomain.BaseDirectory + "/Content/Images/defaultAvatar.png";
                    FileStream file = new FileStream(path, FileMode.Open);

                    using (var binary = new BinaryReader(file)) {
                        imageData = binary.ReadBytes((int)file.Length);
                    }
                }

                profile.Id           = User.Identity.GetUserId();
                profile.ProfileImage = imageData;
                profile.IsActive     = true;
                profileRepository.Add(profile);
                profileRepository.Save();
                return(RedirectToAction("Index"));
            }
            return(RedirectToAction("Create"));
        }
Ejemplo n.º 2
0
        public ActionResult Manage([Bind(Exclude = "ProfileImage")] ProfileModels profile)
        {
            // Excludes ProfileImage from controller call so it doesn't crash.
            if (ModelState.IsValid)
            {
                // Backup the profile image before possible change
                string profileId       = profile.Id;
                byte[] backupImageCopy = profileRepository.Get(profileId).ProfileImage;

                //Possible new profile image input
                byte[] imageData = null;
                if (Request.Files["ProfileImage"].ContentLength >= 1)
                {
                    HttpPostedFileBase poImgFile = Request.Files["ProfileImage"];

                    using (var binary = new BinaryReader(poImgFile.InputStream)) {
                        //This is the byte-array we set as the ProfileImage property on the profile.
                        imageData = binary.ReadBytes(poImgFile.ContentLength);
                    }
                }
                if (imageData != null)   // If there is a new file input
                {
                    profile.ProfileImage = imageData;
                }
                else                                        // If there is not a new file input
                {
                    profile.ProfileImage = backupImageCopy; // To make sure "null" is not submitted into the database
                }

                profileRepository.Edit(profile);
                profileRepository.Save();
                return(RedirectToAction("Index"));
            }
            return(RedirectToAction("Manage"));
        }
Ejemplo n.º 3
0
        public IHttpActionResult GetProfileDetails(string emailId)
        {
            profileModel = new ProfileModels();
            SqlConnection  sqlConnection = SQLHelperClasses.SqlHelper.OpenConnection();
            const string   procedureName = "GetProfileDetails";
            SqlCommand     cmd           = new SqlCommand(procedureName, sqlConnection);
            SqlDataAdapter da            = new SqlDataAdapter();
            DataTable      dt            = new DataTable();

            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.Clear();

            SqlParameter paramEmail = new SqlParameter();

            try
            {
                paramEmail.ParameterName = "@EmailId";
                paramEmail.Direction     = System.Data.ParameterDirection.Input;
                paramEmail.SqlDbType     = System.Data.SqlDbType.VarChar;
                paramEmail.Value         = emailId;
                paramEmail.Size          = 50;
                cmd.Parameters.Add(paramEmail);
                da.SelectCommand = cmd;
                da.Fill(dt);
                int    rows      = dt.Rows.Count;
                string firstName = string.Empty;
                string lastName  = string.Empty;

                for (int i = 0; i < rows; i++)
                {
                    profileModel.AboutMe = dt.Rows[i]["AboutMe"].ToString();
                    profileModel.City    = dt.Rows[i]["City"].ToString();
                    profileModel.Country = dt.Rows[i]["Country"].ToString();
                    profileModel.Sex     = dt.Rows[i]["Gender"].ToString();
                    string fullName = dt.Rows[i]["fullName"].ToString();
                    var    name     = fullName.Split(' ');
                    profileModel.firstName = name[0];
                    profileModel.lastName  = name[1];

                    profileModel.Mobile       = dt.Rows[i]["Mobile"].ToString();
                    profileModel.Organization = dt.Rows[i]["Organisation"].ToString();
                    profileModel.DOB          = dt.Rows[i]["DateOfBirth"].ToString();
                }

                if (rows > 0)
                {
                    return(Ok(profileModel));
                }
                else
                {
                    HttpError error           = new HttpError("No Rows found");
                    var       responseMessage = Request.CreateErrorResponse(HttpStatusCode.NotFound, error);
                    throw new HttpResponseException(responseMessage);
                }
            }
            catch (Exception exception)
            {
                throw new Exception(exception.ToString());
            }
        }
Ejemplo n.º 4
0
        public ActionResult AcceptRequest(string Id)
        {
            string        currentUserId = User.Identity.GetUserId();
            ProfileModels profile       = profileRepository.Get(Id);

            if (requestRepository.IncomingRequestPending(currentUserId, profile.Id))
            {
                List <RequestModels> requests = requestRepository.GetAllRequestsSentToUserById(currentUserId);
                foreach (RequestModels item in requests)
                {
                    if (item.RequestFromId.Equals(profile.Id) && item.RequestToId.Equals(currentUserId)) // To find the requests between the two users
                    {
                        requestRepository.Remove(item.Id);                                               // Remove said requests
                        requestRepository.Save();                                                        // Save new state
                        friendRepository.Add(new FriendModels {
                            UserId         = profile.Id,
                            FriendId       = currentUserId,
                            FriendCategory = 1
                        });
                        friendRepository.Save();
                        return(Json(new { Result = true }));
                    }
                }
            }
            return(Json(new { Result = false }));
        }
Ejemplo n.º 5
0
        public ActionResult Profile(int id = 0, string ad = "")
        {
            List <DB.Addresses> adresses = null;

            DB.Addresses currentAdres = new DB.Addresses();
            if (id == 0)
            {
                id       = base.CurrentUserId();
                adresses = context.Addresses.Where(x => x.Member_Id == id).ToList();
                if (string.IsNullOrEmpty(ad) == false)
                {
                    var guid = new Guid(ad);
                    currentAdres = context.Addresses.FirstOrDefault(x => x.Id == guid);
                }
            }
            var user = context.Members.FirstOrDefault(x => x.Id == id);

            if (user == null)
            {
                return(RedirectToAction("Index", "i"));
            }
            ProfileModels model = new ProfileModels()
            {
                Members        = user,
                Addresses      = adresses,
                CurrentAddress = currentAdres
            };

            return(View(model));
        }
Ejemplo n.º 6
0
 public ActionResult Register(ProfileModels models)
 {
     if (ModelState.IsValid)
     {
         var m = models.Email;
     }
     return(View());
 }
Ejemplo n.º 7
0
        public PartialViewResult GetMatchPartial(string profileId)
        {
            ProfileModels currentUserProfile = profileRepository.Get(User.Identity.GetUserId());
            ProfileModels visitedProfile     = profileRepository.Get(profileId);

            // Return (PartialView, model);
            return(PartialView("_MatchPop", MatchUserAgainstOtherUser(currentUserProfile, visitedProfile)));
        }
Ejemplo n.º 8
0
        private ProfileModels updateModel()
        {
            ProfileModels profilemodel = new ProfileModels();
            string        sPath        = "";

            //Server File Path
            sPath = System.Web.Hosting.HostingEnvironment.MapPath("~/Uploads/");

            try
            {
                //retreive the image from Request
                System.Web.HttpFileCollection hfc = System.Web.HttpContext.Current.Request.Files;
                HttpRequest request = HttpContext.Current.Request;

                if (hfc.Count > 0)
                {
                    System.Web.HttpPostedFile hpf = hfc[0];

                    if (hpf.ContentLength > 0)
                    {
                        // save the file in the directory
                        hpf.SaveAs(sPath + Path.GetFileName(hpf.FileName));

                        //Read the bytes of the file
                        byte[] imageData = File.ReadAllBytes(sPath + Path.GetFileName(hpf.FileName));

                        //bind to profilePicture model
                        profilemodel.ProfilePicture = imageData;

                        //Finally delete the saved file as we are saving it to the database
                        File.Delete(sPath + Path.GetFileName(hpf.FileName));
                    }
                }
                if (request.Form.Keys.Count > 0)
                {
                    profilemodel.AboutMe      = request.Form["AboutMe"];
                    profilemodel.firstName    = request.Form["firstName"];
                    profilemodel.lastName     = request.Form["lastName"];
                    profilemodel.DOB          = request.Form["DOB"];
                    profilemodel.Mobile       = request.Form["Mobile"];
                    profilemodel.Organization = request.Form["Organization"];
                    profilemodel.Country      = request.Form["Country"];
                    profilemodel.AboutMe      = request.Form["AboutMe"];
                    profilemodel.Sex          = request.Form["Sex"];
                    profilemodel.EmailId      = request.Form["EmailId"];
                    profilemodel.City         = request.Form["City"];
                    profilemodel.Website      = request.Form["Website"];
                }
            }
            catch (Exception exception)
            {
                throw new Exception(exception.ToString());
            }
            return(profilemodel);
        }
Ejemplo n.º 9
0
        public ActionResult IsFriend(string Id)
        {
            string        currentUserId = User.Identity.GetUserId();
            ProfileModels profile       = profileRepository.Get(Id);

            if (friendRepository.IsFriendAlready(currentUserId, profile.Id))
            {
                return(Json(new { Result = true }));
            }
            return(Json(new { Result = false }));
        }
Ejemplo n.º 10
0
        public ActionResult IncomingRequestPending(string Id)
        {
            string        currentUserId = User.Identity.GetUserId();
            ProfileModels profile       = profileRepository.Get(Id);

            if (requestRepository.IncomingRequestPending(currentUserId, profile.Id))
            {
                return(Json(new { Result = true }));
            }
            return(Json(new { Result = false }));
        }
Ejemplo n.º 11
0
        public ActionResult SuspendAccount()
        {
            ProfileModels profile = profileRepository.Get(User.Identity.GetUserId());

            profile.IsActive = false;
            profileRepository.Edit(profile);
            profileRepository.Save();

            Microsoft.Owin.Security.IAuthenticationManager AuthenticationManager = HttpContext.GetOwinContext().Authentication;
            AuthenticationManager.SignOut();
            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 12
0
        public void Init(bool autoPlay = false, string token = null)
        {
            _autoPlay = autoPlay;

            ProfileModels = _settingsStorage
                            .GetValue <string>(SettingsKeys.Profiles)
                            .FromJson <ICollection <ProfileModel> >(JsonConverter);

            SelectedProfileModel = token != null
                ? ProfileModels.SingleOrDefault(pm => pm.Token == token)
                : ProfileModels.FirstOrDefault();
        }
Ejemplo n.º 13
0
        public HttpResponseMessage GetProfileImage(string emailId)
        {
            var response = Request.CreateResponse(HttpStatusCode.OK);

            profileModel = new ProfileModels();
            SqlConnection sqlConnection = SQLHelperClasses.SqlHelper.OpenConnection();
            const string  procedureName = "GetProfileImage";
            SqlCommand    cmd           = new SqlCommand(procedureName, sqlConnection);

            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.Clear();

            SqlParameter paramProfileImage = new SqlParameter();
            SqlParameter paramEmail        = new SqlParameter();

            try
            {
                paramProfileImage.ParameterName = "@ProfileImage";
                paramProfileImage.SqlDbType     = System.Data.SqlDbType.VarBinary;
                paramProfileImage.Direction     = System.Data.ParameterDirection.Output;
                paramProfileImage.Size          = 100000;

                paramEmail.ParameterName = "@EmailId";
                paramEmail.Direction     = System.Data.ParameterDirection.Input;
                paramEmail.SqlDbType     = System.Data.SqlDbType.VarChar;
                paramEmail.Value         = emailId;
                paramEmail.Size          = 50;
                cmd.Parameters.Add(paramEmail);
                cmd.Parameters.Add(paramProfileImage);

                cmd.ExecuteNonQuery();

                if (paramProfileImage.Value != null)
                {
                    profileModel.ProfilePicture = (byte[])paramProfileImage.Value;
                    MemoryStream ms = new MemoryStream(profileModel.ProfilePicture);
                    response.Content = new StreamContent(ms);
                    response.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("image/png");
                }
            }
            catch (Exception exception)
            {
                throw new Exception(exception.ToString());
            }
            finally
            {
                cmd.Dispose();
                sqlConnection.Close();
                sqlConnection.Dispose();
            }
            return(response);
        }
Ejemplo n.º 14
0
        public ActionResult Index()
        {
            string currentUser = User.Identity.GetUserId();
            List <ProfileModels>    allProfiles        = profileRepository.GetAllProfilesExceptCurrent(currentUser);
            ProfileModels           currentUserProfile = profileRepository.Get(currentUser);
            List <SearchViewModels> convertedList      = new List <SearchViewModels>();

            foreach (ProfileModels item in allProfiles)   // Convert from ProfileModels to SearchViewModels and add to list
            {
                convertedList.Add(MatchUserAgainstOtherUser(currentUserProfile, item));
            }
            return(View(convertedList.OrderByDescending((p) => p.Percentage))); // Sort list to have users appear in the search window by match percentage by default
        }
Ejemplo n.º 15
0
        // GET: Profile
        public ActionResult Index()
        {
            object profileId     = Request.RequestContext.RouteData.Values["id"];
            string currentUserId = User.Identity.GetUserId();

            if (string.IsNullOrWhiteSpace((string)profileId))
            {
                profileId = currentUserId;
            }

            // Add user to visitor list for the visited profile, but remove them first if they're already in the 5 latest
            if (!string.Equals(currentUserId, (string)profileId))
            {
                List <VisitorModels> allVisitors = visitorRepository.GetAllVisitorsByUserId((string)profileId);                // Everyone who has looked at this profile
                if (allVisitors.Any((v) => v.VisitFromId.Equals(currentUserId)))                                               // If current user has already visited this profile
                {
                    visitorRepository.Remove(visitorRepository.GetVisitIdByVisitFromUserId((string)profileId, currentUserId)); // Remove the visit by the current user
                }
                VisitorModels visitor = new VisitorModels {
                    VisitDateTime = DateTime.Now,
                    VisitFromId   = currentUserId,
                    VisitToId     = (string)profileId
                };
                visitorRepository.Add(visitor);
                visitorRepository.Save();
            }

            ProfileModels            userProfile              = profileRepository.Get((string)profileId);
            List <PostModels>        posts                    = postRepository.GetAllPostsForUserById((string)profileId);
            List <FriendModels>      friends                  = friendRepository.GetAllFriendsByUserId((string)profileId);
            PostViewModelsForUsers   postViewModelForUsers    = ConvertPostToPostViewModelForUsers(posts, (string)profileId);
            FriendViewModelsForUsers friendViewModelsForUsers = ConvertFriendToFriendViewModelsForUsers(friends, (string)profileId);

            ProfileViewModel userProfileViewModel = new ProfileViewModel {
                Id           = userProfile.Id,
                FirstName    = userProfile.FirstName,
                LastName     = userProfile.LastName,
                Gender       = userProfile.Gender,
                Biography    = userProfile.Biography,
                BirthDate    = userProfile.BirthDate.ToShortDateString(),
                IsActive     = userProfile.IsActive,
                Posts        = postViewModelForUsers,
                Friends      = friendViewModelsForUsers,
                ProfileImage = userProfile.ProfileImage
            };

            ViewBag.ProfileRelation = GetProfileRelation((string)profileId);

            return(View(userProfileViewModel));
        }
Ejemplo n.º 16
0
        private void LoadPreset()
        {
            var profileModelsDict = ProfileModels
                                    .Where(pm => pm.Token != null)
                                    .ToDictionary(pm => pm.Token);

            foreach (var profileToken in SelectedPresetModel.ProfileTokens.Select((t, i) => new { t, i }))
            {
                ProfileModel profileModel;

                QuadCellViewModels[profileToken.i].SelectedProfileModel = profileToken.t != null && profileModelsDict.TryGetValue(SelectedPresetModel.ProfileTokens[profileToken.i], out profileModel)
                    ? profileModel
                    : EmptyProfileModel;
            }
        }
Ejemplo n.º 17
0
        public ActionResult ProfileEdit()
        {
            int id   = base.CurrentUserId();
            var user = context.Members.FirstOrDefault(x => x.Id == id);

            if (user == null)
            {
                return(RedirectToAction("Index", "i"));
            }
            ProfileModels model = new ProfileModels()
            {
                Members = user
            };

            return(View(model));
        }
Ejemplo n.º 18
0
        public void Init(string token)
        {
            _token = token;

            ProfileModels = _settingsStorage
                            .GetValue <string>(SettingsKeys.Profiles)
                            .FromJson <ICollection <ProfileModel> >(JsonConverter);

            ProfileModels.Add(EmptyProfileModel);
            foreach (var quadCellViewModel in QuadCellViewModels)
            {
                quadCellViewModel.SelectedProfileModel = EmptyProfileModel;
            }

            RestoreSettings();
        }
Ejemplo n.º 19
0
        public ActionResult RemoveFriend(string Id)
        {
            string              currentUserId = User.Identity.GetUserId();
            ProfileModels       profile       = profileRepository.Get(Id);
            List <FriendModels> friends       = friendRepository.GetAllFriendsByUserId(currentUserId);

            foreach (FriendModels friend in friends)
            {
                if (friend.UserId.Equals(currentUserId) && friend.FriendId.Equals(profile.Id) || friend.UserId.Equals(profile.Id) && friend.FriendId.Equals(currentUserId))
                {
                    friendRepository.Remove(friend.Id);
                    friendRepository.Save();
                    return(Json(new { Result = true }));
                }
            }
            return(Json(new { Result = false }));
        }
Ejemplo n.º 20
0
        public FileContentResult RenderProfileImage(string userId)
        {
            //Converts the stored byte-array to an image. This action is called with razor in views to be used in img tags.
            var           profileId = Request.RequestContext.RouteData.Values["id"];
            ProfileModels profile   = null;

            if (!string.IsNullOrWhiteSpace(userId))
            {
                profile = profileRepository.Get(userId);
            }
            else
            {
                profile = profileRepository.Get((string)profileId);
            }

            return(new FileContentResult(profile.ProfileImage, "image/jpeg"));
        }
Ejemplo n.º 21
0
        public ActionResult MemberProfile()
        {
            ResponseModels _ResponseModel = new ResponseModels();
            ProfileModels  model          = new ProfileModels();

            if (Session[SessionVariable.LoginUserDetails] != null)
            {
                _ResponseModel  = (ResponseModels)Session[SessionVariable.LoginUserDetails];
                model.FirstName = _ResponseModel.FirstName;
                model.LastName  = _ResponseModel.LastName;
                model.UserID    = _ResponseModel.UserID;
                Session[SessionVariable.UserID] = _ResponseModel.UserID;
                return(View(model));
            }
            else
            {
                return(RedirectToAction("Login"));
            }
        }
Ejemplo n.º 22
0
        public ActionResult ProfileEdit(ProfileModels model)
        {
            try
            {
                int id           = CurrentUserId();
                var updateMember = context.Members.FirstOrDefault(x => x.Id == id);
                updateMember.ModifiedDate = DateTime.Now;
                updateMember.Bio          = model.Members.Bio;
                updateMember.Name         = model.Members.Name;
                updateMember.Surname      = model.Members.Surname;

                if (string.IsNullOrEmpty(model.Members.Password) == false)
                {
                    updateMember.Password = model.Members.Password;
                }
                if (Request.Files != null && Request.Files.Count > 0)
                {
                    var file = Request.Files[0];
                    if (file.ContentLength > 0)
                    {
                        var folder   = Server.MapPath("~/images/upload/Account");
                        var fileName = Guid.NewGuid() + ".jpg";
                        file.SaveAs(Path.Combine(folder, fileName));

                        var filePath = "images/upload/Account/" + fileName;
                        updateMember.ProfileImageName = filePath;
                    }
                }
                context.SaveChanges();

                return(RedirectToAction("Profile", "Account"));
            }
            catch (Exception ex)
            {
                ViewBag.MyError = ex.Message;
                int id        = CurrentUserId();
                var ViewModel = new Models.Account.ProfileModels()
                {
                    Members = context.Members.FirstOrDefault(x => x.Id == id)
                };
                return(View(ViewModel));
            }
        }
Ejemplo n.º 23
0
        public ActionResult SendRequest(string Id)
        {
            string        currentUserId = User.Identity.GetUserId();
            ProfileModels profile       = profileRepository.Get(Id);

            if (requestRepository.RequestPending(profile.Id, currentUserId))   // If there already is a request on the way
            {
                return(Json(new { Result = false }));
            }

            // If there is NOT already a request on the way
            requestRepository.Add(new RequestModels {
                RequestDateTime = DateTime.Now,
                RequestFromId   = currentUserId,
                RequestToId     = profile.Id
            });
            requestRepository.Save();
            return(Json(new { Result = true }));
        }
Ejemplo n.º 24
0
        public IActionResult CreateProfile([FromBody] ProfileModels profile)
        {
            var p = new Profile();
            var usernameExists = _context.Profile.Where(x => x.UserName == profile.UserName).FirstOrDefault() != null;

            if (profile.FullName == null)
            {
                return(BadRequest("No Full Name given"));
            }
            else if (usernameExists)
            {
                return(BadRequest("Username already exists."));
            }
            else if (profile.Password == null)
            {
                return(BadRequest("No password given"));
            }
            else if (profile != null)
            {
                profile.Status = ProfileState.Active;
            }

            p.FullName = profile.FullName;
            p.UserName = profile.UserName;
            p.Password = profile.Password;
            p.Status   = profile.Status;

            _context.Profile.Add(p);

            _context.SaveChanges();

            profile.Id = p.Id;

            if (profile.Picture != null)
            {
                var image = new ImageHandler(connectionString: _config.GetConnectionString("TwittDatabase"));

                image.StoreImageProfile(profile);
            }

            return(Ok($"{profile.UserName} was created."));
        }
Ejemplo n.º 25
0
        public ActionResult CancelRequest(string Id)
        {
            string        currentUserId = User.Identity.GetUserId();
            ProfileModels profile       = profileRepository.Get(Id);

            if (requestRepository.OutgoingRequestPending(currentUserId, profile.Id))
            {
                List <RequestModels> requests = requestRepository.GetAllRequestsSentByUserId(currentUserId);
                foreach (RequestModels item in requests)
                {
                    if (item.RequestFromId.Equals(currentUserId) && item.RequestToId.Equals(profile.Id)) // To find the requests between the two users
                    {
                        requestRepository.Remove(item.Id);                                               // Remove said requests
                        requestRepository.Save();                                                        // Save new state
                        return(Json(new { Result = true }));
                    }
                }
            }
            return(Json(new { Result = false }));
        }
Ejemplo n.º 26
0
        public async Task <ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            // This doesn't count login failures towards account lockout
            // To enable password failures to trigger account lockout, change to shouldLockout: true
            var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout : false);

            switch (result)
            {
            case SignInStatus.Success:
                string currentUserId = userRepository.GetUserIdByEmail(model.Email);
                if (!profileRepository.IfProfileExists(currentUserId))
                {
                    return(RedirectToAction("Create", "Profile"));    // If user has no profile, they get to create one
                }
                ProfileModels profile = profileRepository.Get(currentUserId);
                if (!profile.IsActive)
                {
                    // If the user is not currently active, they are set to active upon successful login attempt.
                    profile.IsActive = true;
                    profileRepository.Edit(profile);
                    profileRepository.Save();
                }
                return(RedirectToLocal(returnUrl));

            case SignInStatus.LockedOut:
                return(View("Lockout"));

            case SignInStatus.RequiresVerification:
                return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe }));

            case SignInStatus.Failure:
            default:
                ModelState.AddModelError("", "Invalid login attempt.");
                return(View(model));
            }
        }
Ejemplo n.º 27
0
        public new ActionResult Profile()
        {
            var userID = User.Identity.GetUserId();
            var user   = db.AspNetUsers.Find(userID);

            ProfileModels profileModel = new ProfileModels();

            string  json = SendRequest("https://api.fortnitetracker.com/v1/profile/pc/" + user.EpicUsername);
            JObject data = JObject.Parse(json);


            profileModel.username = user.UserName;
            profileModel.epicname = user.EpicUsername;
            profileModel.wins     = (int)data["lifeTimeStats"][8]["value"];
            profileModel.matches  = (int)data["lifeTimeStats"][7]["value"];
            profileModel.elims    = (int)data["lifeTimeStats"][10]["value"];
            profileModel.kdr      = Math.Round(((double)profileModel.elims / (double)profileModel.matches), 2);
            profileModel.image    = (string)data["avatar"];

            return(View(profileModel));
        }
Ejemplo n.º 28
0
        public void StoreImageProfile(ProfileModels profile)
        {
            var id = profile.Id;
            var s  = profile.Picture;

            using (var connection = new SqlConnection(_connectionString))
            {
                connection.Open();

                using (var command = connection.CreateCommand())
                {
                    command.CommandText = @"Update Profile SET Picture = @pic WHERE ID = @id";

                    var pic = ConvertStringToByteArray(s);

                    command.Parameters.AddWithValue(@"pic", pic);
                    command.Parameters.AddWithValue(@"id", id);

                    command.ExecuteNonQuery();
                }
            }
        }
        public static void SeedUsers(ApplicationDbContext context)
        {
            // Create the users
            UserStore <ApplicationUser>   store   = new UserStore <ApplicationUser>(context);
            UserManager <ApplicationUser> manager = new UserManager <ApplicationUser>(store);

            ApplicationUser eliasU = new ApplicationUser {
                UserName = "******",
                Email    = "*****@*****.**"
            };

            manager.Create(eliasU, "password");
            ApplicationUser nicoU = new ApplicationUser {
                UserName = "******",
                Email    = "*****@*****.**"
            };

            manager.Create(nicoU, "password");
            ApplicationUser oskarU = new ApplicationUser {
                UserName = "******",
                Email    = "*****@*****.**"
            };

            manager.Create(oskarU, "password");
            ApplicationUser randomU = new ApplicationUser {
                UserName = "******",
                Email    = "*****@*****.**"
            };

            manager.Create(randomU, "password");
            ApplicationUser corazonU = new ApplicationUser {
                UserName = "******",
                Email    = "*****@*****.**"
            };

            manager.Create(corazonU, "password");
            ApplicationUser andreasU = new ApplicationUser {
                UserName = "******",
                Email    = "*****@*****.**"
            };

            manager.Create(andreasU, "password");
            ApplicationUser mathiasU = new ApplicationUser {
                UserName = "******",
                Email    = "*****@*****.**"
            };

            manager.Create(mathiasU, "password");
            ApplicationUser lightU = new ApplicationUser {
                UserName = "******",
                Email    = "*****@*****.**"
            };

            manager.Create(lightU, "password");
            ApplicationUser hakU = new ApplicationUser {
                UserName = "******",
                Email    = "*****@*****.**"
            };

            manager.Create(hakU, "password");
            ApplicationUser alfonsU = new ApplicationUser {
                UserName = "******",
                Email    = "*****@*****.**"
            };

            manager.Create(alfonsU, "password");


            // Define Profiles
            ProfileModels eliasP = new ProfileModels {
                Id           = eliasU.Id,
                FirstName    = "Elias",
                LastName     = "Stagg",
                Gender       = Gender.Man,
                Biography    = "This is an example biography of the profile for Elias Stagg.",
                BirthDate    = new DateTime(1998, 04, 22),
                Desperation  = 10,
                Loneliness   = 10,
                Horniness    = 4,
                Pride        = 6,
                ProfileImage = setInitializerProfilePicture("/Content/Images/stagg.jpg")
            };
            ProfileModels nicoP = new ProfileModels {
                Id           = nicoU.Id,
                FirstName    = "Nicolas",
                LastName     = "Björkefors",
                Gender       = Gender.Man,
                Biography    = "This is an example biography of the profile for Nicolas Björkefors.",
                BirthDate    = new DateTime(1998, 01, 05),
                Desperation  = 9,
                Loneliness   = 10,
                Horniness    = 3,
                Pride        = 8,
                ProfileImage = setInitializerProfilePicture("/Content/Images/smugOkuu.png")
            };
            ProfileModels oskarP = new ProfileModels {
                Id           = oskarU.Id,
                FirstName    = "Oskar",
                LastName     = "Olofsson",
                Gender       = Gender.Man,
                Biography    = "This is an example biography of the profile for Oskar Olofsson.",
                BirthDate    = new DateTime(1982, 09, 15),
                Desperation  = 9,
                Loneliness   = 10,
                Horniness    = 10,
                Pride        = 1,
                ProfileImage = setInitializerProfilePicture("/Content/Images/pickadoller.jpg")
            };
            ProfileModels randomP = new ProfileModels {
                Id           = randomU.Id,
                FirstName    = "Random",
                LastName     = "Svensson",
                Gender       = Gender.Attackhelicopter,
                Biography    = "This is an example biography of the profile for Random Svensson.",
                BirthDate    = new DateTime(1980, 08, 14),
                Desperation  = 5,
                Loneliness   = 6,
                Horniness    = 10,
                Pride        = 9,
                ProfileImage = setInitializerProfilePicture("/Content/Images/random.png")
            };
            ProfileModels corazonP = new ProfileModels {
                Id           = corazonU.Id,
                FirstName    = "Corazon",
                LastName     = "D'amico",
                Gender       = Gender.Man,
                Biography    = "Este es un ejemplo de biografía del perfil de Corazon D'amico.",
                BirthDate    = new DateTime(1971, 07, 15),
                Desperation  = 10,
                Loneliness   = 10,
                Horniness    = 7,
                Pride        = 3,
                ProfileImage = setInitializerProfilePicture("/Content/Images/corazon.png")
            };
            ProfileModels andreasP = new ProfileModels {
                Id           = andreasU.Id,
                FirstName    = "Andreas",
                LastName     = "Ask",
                Gender       = Gender.Man,
                Biography    = "Ja, nu har du hittat min profil. Diskutera vad detta innebär sakligt i par eller nåt. Och förresten har någon sett min fez?",
                BirthDate    = new DateTime(1900, 01, 25),
                Desperation  = 8,
                Loneliness   = 10,
                Horniness    = 7,
                Pride        = 5,
                ProfileImage = setInitializerProfilePicture("/Content/Images/ask.jpg")
            };
            ProfileModels mathiasP = new ProfileModels {
                Id           = mathiasU.Id,
                FirstName    = "Mathias",
                LastName     = "Hatakka",
                Gender       = Gender.Man,
                Biography    = "Jag har en katt, och katten. Har flera katter. Mitt hem är praktiskt taget ett katthem.",
                BirthDate    = new DateTime(1900, 05, 11),
                Desperation  = 5,
                Loneliness   = 10,
                Horniness    = 7,
                Pride        = 8,
                ProfileImage = setInitializerProfilePicture("/Content/Images/katt.jpg")
            };
            ProfileModels lightP = new ProfileModels {
                Id           = lightU.Id,
                FirstName    = "月",
                LastName     = "夜神",
                Gender       = Gender.Man,
                Biography    = "を魚取り、ヌードリングする",
                BirthDate    = new DateTime(1996, 03, 22),
                Desperation  = 3,
                Loneliness   = 10,
                Horniness    = 7,
                Pride        = 10,
                ProfileImage = setInitializerProfilePicture("/Content/Images/light.png")
            };
            ProfileModels hakP = new ProfileModels {
                Id           = hakU.Id,
                FirstName    = "Hak",
                LastName     = "Son",
                Gender       = Gender.Man,
                Biography    = "Don't come near me or the princess. I'll kill you.",
                BirthDate    = new DateTime(1982, 09, 29),
                Desperation  = 2,
                Loneliness   = 10,
                Horniness    = 8,
                Pride        = 10,
                ProfileImage = setInitializerProfilePicture("/Content/Images/hak.png")
            };
            ProfileModels alfonsP = new ProfileModels {
                Id           = alfonsU.Id,
                FirstName    = "Alfons",
                LastName     = "Åberg",
                Gender       = Gender.Man,
                Biography    = "Någon som vill med på brajbaxningsäventyr?",
                BirthDate    = new DateTime(2002, 12, 11),
                Desperation  = 6,
                Loneliness   = 10,
                Horniness    = 4,
                Pride        = 10,
                ProfileImage = setInitializerProfilePicture("/Content/Images/braj.png")
            };

            // Define Posts
            PostModels post1 = new PostModels {
                PostFromId   = eliasU.Id,
                PostToId     = randomU.Id,
                PostDateTime = new DateTime(2019, 01, 12, 14, 44, 24),
                Text         = "Praise RNGesus!"
            };
            PostModels post2 = new PostModels {
                PostFromId   = oskarU.Id,
                PostToId     = randomU.Id,
                PostDateTime = new DateTime(2019, 01, 13, 23, 45, 02),
                Text         = "Shit asså."
            };
            PostModels post3 = new PostModels {
                PostFromId   = nicoU.Id,
                PostToId     = randomU.Id,
                PostDateTime = new DateTime(2019, 01, 14, 19, 01, 08),
                Text         = "Söker efter någon att spela Pokémon Reborn med!"
            };
            PostModels post4 = new PostModels {
                PostFromId   = randomU.Id,
                PostToId     = randomU.Id,
                PostDateTime = new DateTime(2019, 01, 15, 17, 33, 48),
                Text         = "Does this thing work?"
            };
            PostModels post5 = new PostModels {
                PostFromId   = nicoU.Id,
                PostToId     = corazonU.Id,
                PostDateTime = new DateTime(2019, 01, 15, 07, 27, 33),
                Text         = "I'm your biggest fan!"
            };
            PostModels post6 = new PostModels {
                PostFromId   = corazonU.Id,
                PostToId     = corazonU.Id,
                PostDateTime = new DateTime(2019, 01, 15, 08, 03, 17),
                Text         = "Gracias."
            };
            PostModels post7 = new PostModels {
                PostFromId   = corazonU.Id,
                PostToId     = eliasU.Id,
                PostDateTime = new DateTime(2019, 01, 16, 17, 28, 51),
                Text         = "Hola señor."
            };
            PostModels post8 = new PostModels {
                PostFromId   = oskarU.Id,
                PostToId     = nicoU.Id,
                PostDateTime = new DateTime(2019, 01, 18, 22, 04, 55),
                Text         = "Mate, get stuck in there. Scrum!"
            };
            PostModels post9 = new PostModels {
                PostFromId   = eliasU.Id,
                PostToId     = randomU.Id,
                PostDateTime = new DateTime(2019, 01, 20, 19, 05, 33),
                Text         = "Fett avis på din randomness."
            };
            PostModels post10 = new PostModels {
                PostFromId   = lightU.Id,
                PostToId     = alfonsU.Id,
                PostDateTime = new DateTime(2019, 01, 22, 21, 09, 53),
                Text         = "死ね、 人間のくず"
            };
            PostModels post11 = new PostModels {
                PostFromId   = alfonsU.Id,
                PostToId     = mathiasU.Id,
                PostDateTime = new DateTime(2019, 01, 22, 21, 05, 18),
                Text         = "Hej jag vill klappa katter."
            };
            PostModels post12 = new PostModels {
                PostFromId   = andreasU.Id,
                PostToId     = eliasU.Id,
                PostDateTime = new DateTime(2019, 01, 23, 07, 48, 32),
                Text         = "Kom ihåg att evaluera dina hattalternativ noga varje morgon. Idag valde jag min fez."
            };
            PostModels post13 = new PostModels {
                PostFromId   = mathiasU.Id,
                PostToId     = oskarU.Id,
                PostDateTime = new DateTime(2019, 01, 24, 11, 39, 33),
                Text         = "En av mina katter har tappat sitt hår. Får jag låna lite av ditt?"
            };
            PostModels post14 = new PostModels {
                PostFromId   = nicoU.Id,
                PostToId     = lightU.Id,
                PostDateTime = new DateTime(2019, 01, 24, 22, 52, 04),
                Text         = "私はLですwwww."
            };
            PostModels post15 = new PostModels {
                PostFromId   = oskarU.Id,
                PostToId     = alfonsU.Id,
                PostDateTime = new DateTime(2019, 01, 25, 10, 41, 52),
                Text         = "Har svårt att stå emot en sådan lockande inbjudan! Hänger med på studs."
            };
            PostModels post16 = new PostModels {
                PostFromId   = alfonsU.Id,
                PostToId     = andreasU.Id,
                PostDateTime = new DateTime(2019, 02, 14, 06, 37, 09),
                Text         = "Eyy, Andy! Ska du med och baxa braj?"
            };

            // Define requests
            RequestModels request1 = new RequestModels {
                RequestDateTime = DateTime.Now,
                RequestFromId   = nicoU.Id,
                RequestToId     = corazonU.Id
            };
            RequestModels request2 = new RequestModels {
                RequestDateTime = DateTime.Now,
                RequestFromId   = oskarU.Id,
                RequestToId     = corazonU.Id
            };
            RequestModels request3 = new RequestModels {
                RequestDateTime = DateTime.Now,
                RequestFromId   = oskarU.Id,
                RequestToId     = eliasU.Id
            };
            RequestModels request4 = new RequestModels {
                RequestDateTime = DateTime.Now,
                RequestFromId   = randomU.Id,
                RequestToId     = eliasU.Id
            };
            RequestModels request5 = new RequestModels {
                RequestDateTime = DateTime.Now,
                RequestFromId   = nicoU.Id,
                RequestToId     = lightU.Id
            };
            RequestModels request6 = new RequestModels {
                RequestDateTime = DateTime.Now,
                RequestFromId   = lightU.Id,
                RequestToId     = mathiasU.Id
            };
            RequestModels request7 = new RequestModels {
                RequestDateTime = DateTime.Now,
                RequestFromId   = randomU.Id,
                RequestToId     = alfonsU.Id
            };
            RequestModels request8 = new RequestModels {
                RequestDateTime = DateTime.Now,
                RequestFromId   = alfonsU.Id,
                RequestToId     = eliasU.Id
            };
            RequestModels request9 = new RequestModels {
                RequestDateTime = DateTime.Now,
                RequestFromId   = hakU.Id,
                RequestToId     = eliasU.Id
            };
            RequestModels request10 = new RequestModels {
                RequestDateTime = DateTime.Now,
                RequestFromId   = andreasU.Id,
                RequestToId     = nicoU.Id
            };

            // Define FriendCategories
            FriendCategoryModels category1 = new FriendCategoryModels {
                CategoryName = "Default"
            };
            FriendCategoryModels category2 = new FriendCategoryModels {
                CategoryName = "Acquaintances"
            };
            FriendCategoryModels category3 = new FriendCategoryModels {
                CategoryName = "BFFs"
            };

            // Define Visits
            VisitorModels eliasV1 = new VisitorModels {
                VisitDateTime = new DateTime(2019, 01, 25, 10, 41, 52),
                VisitFromId   = nicoU.Id,
                VisitToId     = eliasU.Id
            };
            VisitorModels eliasV2 = new VisitorModels {
                VisitDateTime = new DateTime(2019, 05, 15, 12, 54, 8),
                VisitFromId   = oskarU.Id,
                VisitToId     = eliasU.Id
            };
            VisitorModels eliasV3 = new VisitorModels {
                VisitDateTime = new DateTime(2019, 05, 04, 22, 21, 54),
                VisitFromId   = andreasU.Id,
                VisitToId     = eliasU.Id
            };
            VisitorModels eliasV4 = new VisitorModels {
                VisitDateTime = new DateTime(2019, 02, 21, 23, 15, 12),
                VisitFromId   = lightU.Id,
                VisitToId     = eliasU.Id
            };
            VisitorModels eliasV5 = new VisitorModels {
                VisitDateTime = new DateTime(2019, 05, 25, 13, 41, 45),
                VisitFromId   = randomU.Id,
                VisitToId     = eliasU.Id
            };
            VisitorModels nicoV1 = new VisitorModels {
                VisitDateTime = new DateTime(2019, 05, 25, 13, 41, 45),
                VisitFromId   = randomU.Id,
                VisitToId     = nicoU.Id
            };
            VisitorModels nicoV2 = new VisitorModels {
                VisitDateTime = new DateTime(2019, 07, 30, 20, 35, 26),
                VisitFromId   = andreasU.Id,
                VisitToId     = nicoU.Id
            };
            VisitorModels nicoV3 = new VisitorModels {
                VisitDateTime = new DateTime(2019, 08, 25, 14, 37, 55),
                VisitFromId   = lightU.Id,
                VisitToId     = nicoU.Id
            };
            VisitorModels oskarV = new VisitorModels {
                VisitDateTime = new DateTime(2019, 09, 26, 15, 38, 56),
                VisitFromId   = andreasU.Id,
                VisitToId     = oskarU.Id
            };
            VisitorModels lightV = new VisitorModels {
                VisitDateTime = new DateTime(2019, 05, 24, 19, 48, 26),
                VisitFromId   = andreasU.Id,
                VisitToId     = lightU.Id
            };
            VisitorModels mathiasV = new VisitorModels {
                VisitDateTime = new DateTime(2019, 06, 23, 18, 47, 41),
                VisitFromId   = andreasU.Id,
                VisitToId     = mathiasU.Id
            };
            VisitorModels randomV = new VisitorModels {
                VisitDateTime = new DateTime(2019, 09, 12, 09, 37, 23),
                VisitFromId   = andreasU.Id,
                VisitToId     = randomU.Id
            };
            VisitorModels hakV = new VisitorModels {
                VisitDateTime = new DateTime(2019, 03, 28, 10, 00, 00),
                VisitFromId   = andreasU.Id,
                VisitToId     = randomU.Id
            };
            VisitorModels andreasV = new VisitorModels {
                VisitDateTime = new DateTime(2019, 04, 19, 14, 12, 35),
                VisitFromId   = alfonsU.Id,
                VisitToId     = randomU.Id
            };
            VisitorModels alfonsV = new VisitorModels {
                VisitDateTime = new DateTime(2019, 08, 25, 14, 37, 55),
                VisitFromId   = andreasU.Id,
                VisitToId     = alfonsU.Id
            };

            context.Visitors.AddRange(new[] { eliasV1, eliasV2, eliasV3, eliasV4, eliasV5, nicoV1, nicoV2, nicoV3, oskarV, lightV, mathiasV, randomV, hakV, andreasV, alfonsV });
            context.Profiles.AddRange(new[] { eliasP, nicoP, oskarP, randomP, corazonP, andreasP, mathiasP, lightP, hakP, alfonsP });                                // Add profiles
            context.Posts.AddRange(new[] { post1, post2, post3, post4, post5, post6, post7, post8, post9, post10, post11, post12, post13, post14, post15, post16 }); // Add posts
            context.Requests.AddRange(new[] { request1, request2, request3, request4, request5, request6, request7, request8, request9, request10 });                // Add requests
            context.Categories.AddRange(new[] { category1, category2, category3 });                                                                                  // Add friend categories
            context.SaveChanges();                                                                                                                                   // We need to save the friend categories into the database to be able to access their IDs for the creation of the friends.

            // Define friendships
            FriendModels friends1 = new FriendModels {
                UserId         = nicoU.Id,
                FriendId       = oskarU.Id,
                FriendCategory = category1.Id
            };
            FriendModels friends2 = new FriendModels {
                UserId         = nicoU.Id,
                FriendId       = eliasU.Id,
                FriendCategory = category2.Id
            };
            FriendModels friends3 = new FriendModels {
                UserId         = eliasU.Id,
                FriendId       = corazonU.Id,
                FriendCategory = category3.Id
            };
            FriendModels friends4 = new FriendModels {
                UserId         = oskarU.Id,
                FriendId       = randomU.Id,
                FriendCategory = category1.Id
            };
            FriendModels friends5 = new FriendModels {
                UserId         = oskarU.Id,
                FriendId       = alfonsU.Id,
                FriendCategory = category1.Id
            };
            FriendModels friends6 = new FriendModels {
                UserId         = eliasU.Id,
                FriendId       = lightU.Id,
                FriendCategory = category1.Id
            };
            FriendModels friends7 = new FriendModels {
                UserId         = andreasU.Id,
                FriendId       = eliasU.Id,
                FriendCategory = category1.Id
            };
            FriendModels friends8 = new FriendModels {
                UserId         = nicoU.Id,
                FriendId       = hakU.Id,
                FriendCategory = category1.Id
            };

            context.Friends.AddRange(new[] { friends1, friends2, friends3, friends4, friends5, friends6, friends7, friends8 }); // Add friendships
            context.SaveChanges();
        }
Ejemplo n.º 30
0
        public IHttpActionResult InsertProfile()
        {
            profileModel = updateModel();
            SqlConnection sqlConnection = SQLHelperClasses.SqlHelper.OpenConnection();
            SqlCommand    cmd           = new SqlCommand();

            cmd.Connection  = sqlConnection;
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            const string storedProcedureName = "InsertProfileDetails";

            cmd.CommandText = storedProcedureName;
            cmd.Parameters.Clear();

            SqlParameter paramFullName       = new SqlParameter();
            SqlParameter paramDOB            = new SqlParameter();
            SqlParameter paramOrganization   = new SqlParameter();
            SqlParameter paramCity           = new SqlParameter();
            SqlParameter paramCountry        = new SqlParameter();
            SqlParameter paramMobile         = new SqlParameter();
            SqlParameter paramAboutMe        = new SqlParameter();
            SqlParameter paramGender         = new SqlParameter();
            SqlParameter paramProfilePicture = new SqlParameter();
            SqlParameter paramEmailId        = new SqlParameter();
            SqlParameter paramWebsite        = new SqlParameter();
            SqlParameter paramSuccess        = new SqlParameter();

            string response = string.Empty;

            // Check if the request contains multipart/form-data.
            if (!Request.Content.IsMimeMultipartContent("form-data"))
            {
                HttpError error           = new HttpError("Unsupported Media Type Error");
                var       responseMessage = Request.CreateErrorResponse(HttpStatusCode.NotModified, error);
                throw new HttpResponseException(responseMessage);
            }

            try
            {
                paramFullName.ParameterName = "@Fullname";
                paramFullName.Direction     = System.Data.ParameterDirection.Input;
                paramFullName.SqlDbType     = System.Data.SqlDbType.VarChar;
                paramFullName.Size          = 100;
                paramFullName.Value         = profileModel.firstName + " " + profileModel.lastName;

                paramDOB.ParameterName = "@DateOfBirth";
                paramDOB.Direction     = System.Data.ParameterDirection.Input;
                paramDOB.SqlDbType     = System.Data.SqlDbType.DateTime;
                paramDOB.Value         = profileModel.DOB;


                paramOrganization.ParameterName = "@Organisation";
                paramOrganization.Direction     = System.Data.ParameterDirection.Input;
                paramOrganization.SqlDbType     = System.Data.SqlDbType.VarChar;
                paramOrganization.Value         = profileModel.Organization;
                paramOrganization.Size          = 50;


                paramCity.ParameterName = "@City";
                paramCity.Direction     = System.Data.ParameterDirection.Input;
                paramCity.SqlDbType     = System.Data.SqlDbType.VarChar;
                paramCity.Value         = profileModel.City;
                paramCity.Size          = 50;


                paramCountry.ParameterName = "@Country";
                paramCountry.Direction     = System.Data.ParameterDirection.Input;
                paramCountry.SqlDbType     = System.Data.SqlDbType.VarChar;
                paramCountry.Value         = profileModel.Country;
                paramCountry.Size          = 25;

                paramMobile.ParameterName = "@Mobile";
                paramMobile.Direction     = System.Data.ParameterDirection.Input;
                paramMobile.SqlDbType     = System.Data.SqlDbType.VarChar;
                paramMobile.Value         = profileModel.Mobile;
                paramMobile.Size          = 15;


                paramAboutMe.ParameterName = "@Aboutme";
                paramAboutMe.Direction     = System.Data.ParameterDirection.Input;
                paramAboutMe.SqlDbType     = System.Data.SqlDbType.VarChar;
                paramAboutMe.Value         = profileModel.AboutMe;
                paramAboutMe.Size          = 1000;


                paramGender.ParameterName = "@Gender";
                paramGender.Direction     = System.Data.ParameterDirection.Input;
                paramGender.SqlDbType     = System.Data.SqlDbType.VarChar;
                paramGender.Value         = profileModel.Sex;
                paramGender.Size          = 50;

                paramProfilePicture.ParameterName = "@profilePicture";
                paramProfilePicture.Direction     = System.Data.ParameterDirection.Input;
                paramProfilePicture.SqlDbType     = System.Data.SqlDbType.VarBinary;
                paramProfilePicture.Value         = profileModel.ProfilePicture;

                paramEmailId.ParameterName = "@EmailId";
                paramEmailId.Direction     = System.Data.ParameterDirection.Input;
                paramEmailId.SqlDbType     = System.Data.SqlDbType.VarChar;
                paramEmailId.Value         = profileModel.EmailId;
                paramEmailId.Size          = 50;

                paramWebsite.ParameterName = "@website";
                paramWebsite.Direction     = System.Data.ParameterDirection.Input;
                paramWebsite.SqlDbType     = System.Data.SqlDbType.VarChar;
                paramWebsite.Value         = profileModel.Website;
                paramWebsite.Size          = 50;


                paramSuccess.ParameterName = "@success";
                paramSuccess.Direction     = System.Data.ParameterDirection.Output;
                paramSuccess.SqlDbType     = System.Data.SqlDbType.VarChar;
                paramSuccess.Size          = 1000;


                cmd.Parameters.AddRange(new SqlParameter[] { paramFullName, paramDOB, paramMobile, paramOrganization, paramCountry, paramCity, paramAboutMe, paramGender,
                                                             paramSuccess, paramProfilePicture, paramWebsite, paramEmailId });

                cmd.ExecuteNonQuery();
                if (paramSuccess.Value.Equals("Profile Details for the user added successfully"))
                {
                    response = paramSuccess.Value.ToString();
                }
                else
                {
                    HttpError error           = new HttpError(paramSuccess.Value.ToString());
                    var       responseMessage = Request.CreateErrorResponse(HttpStatusCode.NotModified, error);
                    response = responseMessage.ToString();
                }
            }

            catch (Exception exception)
            {
                throw new Exception(HttpStatusCode.BadRequest + " " + exception.ToString());
            }
            finally
            {
                SQLHelperClasses.SqlHelper.CloseConnection();
                sqlConnection.Dispose();
                cmd.Dispose();
            }
            return(Ok(response + System.Environment.NewLine + paramSuccess.ToString()));
        }