public ShareBarControl()
        {
            InitializeComponent();

            _viewModel           = new ShareViewModel();
            rootGrid.DataContext = _viewModel;
        }
Beispiel #2
0
        public async Task <IActionResult> Index(int?formId)
        {
            if (formId == null)
            {
                return(NotFound());
            }

            var form = await _formRepository.FindAsync(formId.Value);

            if (formId == null)
            {
                return(NotFound());
            }


            var viewModel = new ShareViewModel
            {
                FormId          = formId.Value,
                FormTitle       = form.Title,
                FormDescription = form.Description,
                Link            = Url.Link("view", new { guid = form.Guid })
            };

            return(View(viewModel));
        }
Beispiel #3
0
        public IActionResult Link(ShareViewModel vm)
        {
            var domain   = HttpContext.Request.Host.Value;     //localhos:1234
            var protocol = HttpContext.Request.Scheme + "://"; //https
            var url      = Url.RouteUrl("CarDetailsPage", new { make = vm.Brand, model = vm.Model, registrationNumber = vm.RegistrationNumber, id = vm.CarId });
            var FullUrl  = protocol + domain + url;

            var msg = new MimeMessage();

            msg.From.Add(new MailboxAddress("*****@*****.**"));
            msg.To.Add(new MailboxAddress(vm.Email));

            msg.Subject = "En vän delat bil från BolindersBil";
            msg.Body    = new TextPart("Html")
            {
                Text = "<strong>Kolla in denna schyssta bilen som finns i vårt lager</strong>" + "<br/>" + $"<a href='{FullUrl}' target='_blank'>{FullUrl}</a>",
                ContentTransferEncoding = ContentEncoding.QuotedPrintable
            };


            var client = new MailKit.Net.Smtp.SmtpClient();

            client.Connect("localhost", 25, false);
            client.Send(msg);
            client.Disconnect(true);


            var url2 = Url.RouteUrl("CarDetailsPage", new { make = vm.Brand, model = vm.Model, registrationNumber = vm.RegistrationNumber, id = vm.CarId });

            return(Redirect(url2));
        }
        public IActionResult Share(string albumId, string imgId)
        {
            ShareViewModel vm = new ShareViewModel();

            try
            {
                if (!String.IsNullOrEmpty(albumId))
                {
                    int AlbumId = Convert.ToInt32(Protector.Unprotect(albumId));
                    vm.Album = albums.GetById(AlbumId);
                }
                else if (!String.IsNullOrEmpty(imgId))
                {
                    int img = Convert.ToInt32(Protector.Unprotect(imgId));
                    vm.Photo = photoRepository.GetById(img);
                }
                else
                {
                    return(BadRequest("URL is not correct"));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest("URL is not correct"));
            }
            return(View(vm));
        }
Beispiel #5
0
        public IActionResult Post([FromBody] ShareViewModel model)
        {
            if (model == null)
            {
                return(new StatusCodeResult(500));
            }

            var share = DbContext.Shares.Where(s => s.Id ==
                                               model.Id).FirstOrDefault();

            if (share == null)
            {
                return(NotFound(new
                {
                    Error = String.Format("Stockshare ID {0} has not been found", model.Id)
                }));
            }

            share.Percent   = model.Percent;
            share.Price     = model.Price;
            share.TurbineId = model.TurbineId;

            DbContext.SaveChanges();

            return(new JsonResult(
                       share.Adapt <ShareViewModel>(),
                       JsonSettings));
        }
        public ActionResult Share(ShareViewModel newShareToInsert, string PId)
        {
            NullChecker.NullCheck(new object[] { PId });
            int user        = WebSecurity.CurrentUserId;
            int pid         = (int)EncryptionHelper.Unprotect(PId);
            var postToshare = unitOfWork.PostRepository.GetByID(pid);

            if (postToshare.Shares.Any(ts => ts.SharerUserID == user))
            {
                throw new JsonCustomException(ControllerError.ajaxErrorPatentUser);
            }
            if (ModelState.IsValid)
            {
                Share finalshareToInsrt = newShareToInsert.Share;
                finalshareToInsrt.SharerUserID = user;
                finalshareToInsrt.sharedPostID = postToshare.postID;
                finalshareToInsrt.shareNote    = newShareToInsert.Share.shareNote;
                finalshareToInsrt.insertdate   = DateTime.UtcNow;
                unitOfWork.ShareRepository.Insert(finalshareToInsrt);
                unitOfWork.Save();
                FeedHelper.FeedInsert(FeedType.SessionOfferLike, postToshare.postID, WebSecurity.CurrentUserId);
                return(Json(new { Success = true, Message = Resource.Resource.sharedSuccessfully }));
            }
            throw new ModelStateException(this.ModelState);
        }
Beispiel #7
0
        public ActionResult Share(ShareViewModel model)
        {
            if (string.IsNullOrWhiteSpace(model.ShareUrl))
            {
                model.ShareUrl = Request.Url.AbsoluteUri;
            }

            return(PartialView(model));
        }
Beispiel #8
0
        internal static void ShareViaClipBoard(ShareViewModel model)
        {
            string text = model.Title + "\n" + model.Url;

            if (MessageBox.Show(text, "Copy to Clipboard?", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                Clipboard.SetText(text);
            }
        }
        public SharePage(ShareViewModel viewModel)
        {
            InitializeComponent();

            vm             = viewModel;
            BindingContext = vm;

            imageContainer.Content = vm.MyCachedImage;
        }
Beispiel #10
0
        // Share dialog

        public async Task <IActionResult> Index(EntityOptions opts)
        {
            // We always need an entity Id
            if (opts.Id <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(opts.Id));
            }

            // We always need an entity
            var entity = await _entityStore.GetByIdAsync(opts.Id);

            if (entity == null)
            {
                return(NotFound());
            }

            // Build route values
            RouteValueDictionary routeValues = null;

            // Append offset
            if (opts.ReplyId > 0)
            {
                routeValues = new RouteValueDictionary()
                {
                    ["area"]         = "Plato.Discuss",
                    ["controller"]   = "Home",
                    ["action"]       = "Reply",
                    ["opts.id"]      = entity.Id,
                    ["opts.alias"]   = entity.Alias,
                    ["opts.replyId"] = opts.ReplyId
                };
            }
            else
            {
                routeValues = new RouteValueDictionary()
                {
                    ["area"]       = "Plato.Discuss",
                    ["controller"] = "Home",
                    ["action"]     = "Display",
                    ["opts.id"]    = entity.Id,
                    ["opts.alias"] = entity.Alias
                };
            }

            // Build view model
            var baseUrl = await _contextFacade.GetBaseUrlAsync();

            var viewModel = new ShareViewModel
            {
                Url = baseUrl + _contextFacade.GetRouteUrl(routeValues)
            };

            // Return view
            return(View(viewModel));
        }
Beispiel #11
0
        protected override void OnShareTargetActivated(ShareTargetActivatedEventArgs args)
        {
            base.OnShareTargetActivated(args);

            var view = new ShareView();
            var viewModel = new ShareViewModel();
            viewModel.SetShareTarget(args);
            view.DataContext = viewModel;
            Window.Current.Content = view;
            Window.Current.Activate();
        }
Beispiel #12
0
        public IActionResult GetTurbineList()
        {
            var shareModel = new ShareViewModel();
            var turbines   = DbContext.Turbines.OrderBy(t => t.Id).ToArray();

            foreach (var t in turbines)
            {
                shareModel.Turbines.Add(t.Adapt <TurbineViewModel>());
            }

            return(new JsonResult(shareModel, JsonSettings));
        }
Beispiel #13
0
        protected override void OnShareTargetActivated(ShareTargetActivatedEventArgs args)
        {
            base.OnShareTargetActivated(args);

            var view      = new ShareView();
            var viewModel = new ShareViewModel();

            viewModel.SetShareTarget(args);
            view.DataContext       = viewModel;
            Window.Current.Content = view;
            Window.Current.Activate();
        }
Beispiel #14
0
        public ActionResult Share(string PId)
        {
            NullChecker.NullCheck(new object[] { PId });

            ShareViewModel viewmodel = new ShareViewModel();
            var            pid       = EncryptionHelper.Unprotect(PId);

            viewmodel.ToShare = unitOfWork.PostRepository.GetByID(pid);
            viewmodel.Share   = new Share {
                sharedPostID = pid
            };
            return(PartialView(viewmodel));
        }
Beispiel #15
0
        public ActionResult Edit(string ShId)
        {
            var shareToEdit = unitOfWork.ShareRepository.GetByID(EncryptionHelper.Unprotect(ShId));

            if (!AuthorizationHelper.isRelevant(shareToEdit.shareID))
            {
                throw new JsonCustomException(ControllerError.ajaxError);
            }
            ShareViewModel viewmodel = new ShareViewModel();

            viewmodel.ToShare = shareToEdit.sharedPost;
            viewmodel.Share   = shareToEdit;
            return(PartialView(viewmodel));
        }
Beispiel #16
0
        private async Task <SendGrid.Response> SendEmail(ShareViewModel viewModel)
        {
            var apiKey           = _configuration.GetSection("SendgridApiKey").Value;
            var client           = new SendGridClient(apiKey);
            var from             = new EmailAddress("*****@*****.**");
            var subject          = viewModel.Subject;
            var to               = new EmailAddress(viewModel.Email);
            var plainTextContent = viewModel.Message;
            var htmlContent      = viewModel.Message + "\n" + viewModel.Link;
            var msg              = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent);
            var response         = await client.SendEmailAsync(msg);

            return(response);
        }
        // GET: Share/Edit/5
        public ActionResult Edit(int id)
        {
            var share = _shareRepository.GetById(id);

            var shareViewModel = new ShareViewModel()
            {
                Name              = share.Name,
                UNCPath           = share.UNCPath,
                Amount            = share.InactivityTimeout.Amount,
                Unit              = share.InactivityTimeout.Unit,
                MonitorInactivity = share.MonitorInactivity
            };

            return(View(shareViewModel));
        }
Beispiel #18
0
 internal static void ShareViaSms(ShareViewModel model)
 {
     try
     {
         var task = new SmsComposeTask()
         {
             Body = model.Title + "\n" + model.Url
         };
         task.Show();
     }
     catch (Exception)
     {
         // fast-clicking can result in exception, so we just handle it
     }
 }
        public ActionResult Share(string id, [FromBody] ShareViewModel model)
        {
            var ownerId = HttpContext.User.Identity.Name;

            if (!storyRepository.IsOwner(id, ownerId))
            {
                return(Forbid("You are not the owner of this story"));
            }

            var userToShare = userRepository.GetSingle(u => u.Username == model.Username);

            if (userToShare == null)
            {
                return(BadRequest(new { username = "******" }));
            }
            var owner = userRepository.GetSingle(s => s.Id == ownerId);
            var story = storyRepository.GetSingle(s => s.Id == id, s => s.Shares);

            if (story.OwnerId == ownerId)
            {
                return(BadRequest(new { username = "******" }));
            }

            var existingShare = story.Shares.Find(l => l.UserId == userToShare.Id);

            if (existingShare == null)
            {
                shareRepository.Add(new Share
                {
                    UserId  = userToShare.Id,
                    StoryId = id
                });
                shareRepository.Commit();
                hubContext.Clients.User(userToShare.Id).SendAsync(
                    "notification",
                    new Notification <ShareRelatedPayload>
                {
                    NotificationType = NotificationType.SHARE,
                    Payload          = new ShareRelatedPayload
                    {
                        Username   = owner.Username,
                        StoryTitle = story.Title
                    }
                }
                    );
            }
            return(NoContent());
        }
Beispiel #20
0
 internal static void ShareViaEmail(ShareViewModel model)
 {
     try
     {
         var task = new EmailComposeTask
         {
             Subject = model.Title,
             Body    = string.Format("{0}\n\n{1}", model.Summary, model.Url)
         };
         task.Show();
     }
     catch (Exception)
     {
         // fast-clicking can result in exception, so we just handle it
     }
 }
Beispiel #21
0
        async void Share(ShareViewModel source)
        {
            Java.IO.File file    = new Java.IO.File(source.FileName);
            var          intent  = new Intent(Intent.ActionSend);
            var          fileUri = FileProvider.GetUriForFile(
                this,
                "br.gov.almg.mobilesigner.fileprovider",
                file);

            intent.SetType(source.MimeType);
            intent.PutExtra(Intent.ExtraStream, fileUri);

            var intentChooser = Intent.CreateChooser(intent, "Compartilhar com");

            StartActivityForResult(intentChooser, SHARE);
        }
Beispiel #22
0
        public IActionResult Put([FromBody] ShareViewModel model)
        {
            if (model == null)
            {
                return(new StatusCodeResult(500));
            }

            var share = model.Adapt <Share>();

            DbContext.Shares.Add(share);
            DbContext.SaveChanges();

            return(new JsonResult(
                       share.Adapt <ShareViewModel>(),
                       JsonSettings));
        }
Beispiel #23
0
        public async Task <Guid> Establish(ShareViewModel shareViewModel)
        {
            var share = new Share
            {
                Name             = shareViewModel.Name.ToLower(),
                ShareId          = new Guid(),
                SingleShareValue = GetSingleShareValue(shareViewModel.TotalValue, shareViewModel.TotalCount),
                TotalCount       = shareViewModel.TotalCount,
                TotalValue       = shareViewModel.TotalValue
            };

            _unitOfWork.SharesRepository.Establish(share);
            await _unitOfWork.CommitAsync();

            return(share.ShareId);
        }
        private void ShareButtonClicked(object sender, EventArgs e)
        {
            ShareDialog shareDialog = new ShareDialog();

            ShareViewModel shareViewModel = new ShareViewModel(sender as CardDeck);

            shareViewModel.ErrorOccured +=
                (s, args) =>
            {
                MessageBox.Show(args.GetException().Message);
                shareViewModel.CloseForm.Execute(null);
            };

            shareDialog.DataContext = shareViewModel;
            shareDialog.Owner       = App.Current.MainWindow;
            shareDialog.ShowDialog();
        }
Beispiel #25
0
 internal static void ShareViaSocial(ShareViewModel model)
 {
     try
     {
         var task = new ShareLinkTask()
         {
             Title   = model.Title,
             Message = model.Title,
             LinkUri = new Uri(model.Url, UriKind.Absolute)
         };
         task.Show();
     }
     catch (Exception)
     {
         // fast-clicking can result in exception, so we just handle it
     }
 }
 public ShareViewModel GetOrCreate(Guid coinId)
 {
     if (!NTMinerContext.Instance.ServerContext.CoinSet.Contains(coinId))
     {
         return(new ShareViewModel(coinId));
     }
     if (!_dicByCoinId.TryGetValue(coinId, out ShareViewModel shareVm))
     {
         lock (_locker) {
             if (!_dicByCoinId.TryGetValue(coinId, out shareVm))
             {
                 shareVm = new ShareViewModel(coinId);
                 _dicByCoinId.Add(coinId, shareVm);
             }
         }
     }
     return(shareVm);
 }
Beispiel #27
0
        public async Task <IActionResult> SendForm(ShareViewModel viewModel)
        {
            var form = await _formRepository.FindAsync(viewModel.FormId);

            if (form == null)
            {
                return(NotFound());
            }
            //check viewModel valid

            var response = await SendEmail(viewModel);

            if (!response.IsSuccessStatusCode)
            {
                return(NotFound());
            }

            viewModel.FormTitle = form.Title;

            return(View("Success", viewModel));
        }
Beispiel #28
0
 public void Showing_PhotoViewModel_From_ShareViewModel(
     IRouter router,
     PhotoListViewModel photoListViewModel,
     ShareViewModel shareViewModel,
     PhotoViewModel.Params parameters,
     IPagePresenter presenter,
     IRoutedAppHost host)
 {
     "And the PhotoViewModel Parameters"
     .x(() => parameters = new PhotoViewModel.Params()
     {
         Photo = new Photo()
         {
             PhotoUrl = "Url"
         }
     });
     "And a presenter for the view model"
     .x(() => presenter = Substitute.For <IPagePresenter>());
     "That is registered"
     .x(() => Resolver.Register(() => presenter, typeof(IPagePresenter)));
     "And a IRoutedAppHost"
     .x(() => host = new RoutedAppHost(config));
     "That is started"
     .x(async() => await host.StartAsync());
     "And a IRouter"
     .x(() => router = Resolver.GetService <IRouter>());
     "And I'm at ShareViewModel"
     .x(async() => await router.ShowAsync <ShareViewModel>());
     "When I Show the PhotoViewModel"
     .x(async() => await router.ShowAsync <PhotoViewModel, PhotoViewModel.Params>(parameters));
     "Then I Should have navigated to the PhotoViewModel"
     .x(() =>
     {
         Assert.Collection(Resolver.GetService <INavigator>().TransitionStack,
                           t => t.ViewModel.Should().BeOfType <PhotoListViewModel>(),
                           t => t.ViewModel.Should().BeOfType <PhotoViewModel>());
     });
     "And the PhotoViewModel presenter should have recieved a present call"
     .x(() => presenter.Received().PresentAsync(Arg.Any <object>(), Arg.Any <object>()));
 }
        private async void LstAttachments_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            try
            {
                if (e.SelectedItem == null)
                {
                    return;
                }

                Attachment att = (Attachment)e.SelectedItem;
                lstAttachments.SelectedItem = null;

                string attDir = GetAttachmentDir(this.inboxMessage);
                string file   = fileSystem.JoinPaths(attDir, FileHelper.SanitizeFileName(att.NomeArquivo));

                att.Loading = true;

                bool fileExists = fileSystem.FileExists(file);
                using (var stream = fileSystem.GetFileStream(file))
                {
                    if (!fileExists || stream.Length < att.Tamanho)
                    {
                        await HttpRequest.DownloadFileToStream(EndPointHelper.GetAbsoluteUrl(att.Url), stream);

                        stream.Flush();
                    }
                }

                att.Loading = false;

                ShareViewModel share = new ShareViewModel();
                share.FileName = file;
                share.MimeType = att.MimeType;
                share.Share();
            } catch (Exception ex)
            {
                await DisplayAlert(AppResources.APP_TITLE, ex.Message, AppResources.OK);
            }
        }
        // GET: Suggestion
        public ActionResult Index()
        {
            var model = new PhotosViewModel();
            var repo = new Repository<UserModel>(DbCollection.User);
            var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting);
            var userId = User.Identity.GetUserId();
            var user = repo.GetById(userId);
            model.User = user;
            var shareSetting = repoShare.Gets().First(m => m.UserId.Equals(userId));
            var share = new ShareViewModel
            {
                ShareSetting = shareSetting
            };
            model.Share = share;

            // Read or Edit
            model.Modify = userId == User.Identity.GetUserId();

            model.FlIdUser = user.FirstName.UrlFriendly() + '-' + user.LastName.UrlFriendly() + "-" + user.Id;
            // Test Log
            Log.Error(new Exception("Test"));
            return View(model);
        }
Beispiel #31
0
        public override async Task <IViewProviderResult> BuildDisplayAsync(Article entity, IViewProviderContext context)
        {
            // Build view model
            var baseUrl = await _contextFacade.GetBaseUrlAsync();

            var viewModel = new ShareViewModel
            {
                Url = baseUrl + _contextFacade.GetRouteUrl(new RouteValueDictionary()
                {
                    ["area"]       = "Plato.Articles",
                    ["controller"] = "Home",
                    ["action"]     = "Display",
                    ["opts.id"]    = entity.Id,
                    ["opts.alias"] = entity.Alias
                })
            };

            return(Views(
                       View <ShareViewModel>("Article.Share.Display.Sidebar", model => viewModel)
                       .Zone("sidebar")
                       .Order(int.MaxValue - 100)
                       ));
        }
        public ActionResult Share(int id, string type)
        {
            Image          image;
            Album          album;
            ShareViewModel model;

            var user = _context.Users.Find(User.Identity.GetUserId());

            if (type == "image")
            {
                image = user.Images.FirstOrDefault(m => m.Id == id);

                model = new ShareViewModel
                {
                    Id   = image.Id,
                    Name = image.Name,
                    Url  = image.Url != null ? Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + "/" + "External?url=" + image.Url + "&type=image" : ""
                };
            }
            else if (type == "album")
            {
                album = user.Albums.FirstOrDefault(m => m.Id == id);

                model = new ShareViewModel
                {
                    Id   = album.Id,
                    Name = album.Name,
                    Url  = album.Url != null ? Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + "/" + "External?url=" + album.Url + "&type=album" : ""
                };
            }
            else
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            return(PartialView("~/Views/Shared/_Share.cshtml", model));
        }
        // GET: Suggestion
        public ActionResult Index()
        {
            var model = new SuggestionViewModel();
            var repo = new Repository<UserModel>(DbCollection.User);
            var repoEducation = new Repository<EducationModel>(DbCollection.Education);
            var repoSuggestion = new Repository<SuggestionModel>(DbCollection.SuggestionFriend);
            var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting);
            var userId = User.Identity.GetUserId();
            var user = repo.GetById(userId);
            model.User = user;
            var shareSetting = repoShare.Gets().First(m => m.UserId.Equals(userId));
            var share = new ShareViewModel
            {
                ShareSetting = shareSetting
            };
            model.Share = share;

            #region Get Suggestion List

            var userExistList =
                repoSuggestion.Gets().Where(m => m.UserId == userId).Select(m => m.UserSuggestionId).ToList();
            userExistList.Add(userId);

            // LOCATION - City
            var userLocation = new List<UserModel>();
            if (!string.IsNullOrEmpty(user.City))
            {
                var usersCity = repo.Gets().Where(m => !userExistList.Contains(m.Id.ToString()) && m.City == user.City).ToList();
                userExistList.Add(usersCity.ToString());
                // LOCATION - Country
                if (usersCity.Count < 5)
                {
                    if (!string.IsNullOrEmpty(user.Country))
                    {
                        var usersCountry =
                            repo.Gets()
                                .Where(m => m.Country == user.Country && !userExistList.Contains(user.Id.ToString()))
                                .ToList();
                        userExistList.Add(usersCountry.ToString());
                        userLocation = usersCity.Union(usersCountry).ToList();
                    }
                }
                else
                {
                    userLocation = usersCity;
                }
            }

            // EDUCTION
            var userEducation = new List<UserModel>();
            var listEducationOwner =
                repoEducation.Gets().Where(m => m.UserId.Equals(user.Id.ToString())).Select(m => m.SchoolName);
            var listUserEducationRelation = (from e in repoEducation.Gets().ToList()
                                             where listEducationOwner.Contains(e.SchoolName)
                                             select e).ToList();

            var listUserEducationString = listUserEducationRelation.Select(m => m.UserId).ToList();
            userEducation = repo.Gets().Where(m => listUserEducationString.Contains(user.Id.ToString()) && !userExistList.Contains(user.Id.ToString())).ToList();

            model.ListSuggestion = userLocation.Union(userEducation).ToList();

            #endregion

            // Read or Edit
            model.Modify = userId == User.Identity.GetUserId();

            model.FlIdUser = user.FirstName.UrlFriendly() + '-' + user.LastName.UrlFriendly() + "-" + user.Id;
            // Test Log
            Log.Error(new Exception("Test"));
            return View(model);
        }
        public ActionResult SettingContact()
        {
            var model = new SettingContactViewModel();
            var repo = new Repository<ContactModel>(DbCollection.Contact);
            model.ListContact = repo.Gets().Where(m => m.UserId.Equals(User.Identity.GetUserId())).ToList();
            var repoContactType = new Repository<ContactTypeModel>(DbCollection.ContactType);
            model.ListContactType = repoContactType.Gets();
            #region Share
            var share = new ShareViewModel();
            var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting);
            var repoSystemShare = new Repository<SystemShareModel>(DbCollection.SystemShare);
            share.ShareSetting = repoShare.Gets().First(m => m.UserId.Equals(User.Identity.GetUserId()));
            share.ListSystemShare = repoSystemShare.Gets().Where(m => m.Enable.Equals(true)).ToList();
            model.Share = share;
            #endregion

            return PartialView("_ContactPartial", model);
        }
        public ActionResult SettingDetails()
        {
            var model = new AboutViewModel
            {
                User = GetOwnerUser()
            };

            #region Share
            var share = new ShareViewModel();
            var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting);
            var repoSystemShare = new Repository<SystemShareModel>(DbCollection.SystemShare);
            share.ShareSetting = repoShare.Gets().First(m => m.UserId.Equals(User.Identity.GetUserId()));
            share.ListSystemShare = repoSystemShare.Gets().Where(m => m.Enable.Equals(true)).ToList();
            model.Share = share;
            #endregion

            return PartialView("_DetailsPartial", model);
        }
        public ActionResult SettingEducation()
        {
            var model = new SettingEducationViewModel();
            var repoEducation = new Repository<EducationModel>(DbCollection.Education);
            model.ListEducation = repoEducation.Gets().Where(m => m.UserId.Equals(User.Identity.GetUserId())).ToList();

            #region Share
            var share = new ShareViewModel();
            var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting);
            var repoSystemShare = new Repository<SystemShareModel>(DbCollection.SystemShare);
            share.ShareSetting = repoShare.Gets().First(m => m.UserId.Equals(User.Identity.GetUserId()));
            share.ListSystemShare = repoSystemShare.Gets().Where(m => m.Enable.Equals(true)).ToList();
            model.Share = share;
            #endregion

            return PartialView("_EducationPartial", model);
        }
        public ActionResult SettingExperience()
        {
            var model = new SettingExperienceViewModel();
            var repo = new Repository<ExperienceModel>(DbCollection.Experience);
            var repoEmployment = new Repository<ExperienceEmploymentModel>(DbCollection.ExperienceEmployment);
            var experience = repo.Gets().FirstOrDefault(m => m.UserId.Equals(User.Identity.GetUserId()));
            if (experience != null)
            {
                model.Occupation = experience.Occupation;
                model.Skill = experience.Skill;
            }
            model.ListExperienceEmployment = repoEmployment.Gets().Where(m => m.UserId.Equals(User.Identity.GetUserId())).ToList();

            #region Share
            var share = new ShareViewModel();
            var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting);
            var repoSystemShare = new Repository<SystemShareModel>(DbCollection.SystemShare);
            share.ShareSetting = repoShare.Gets().First(m => m.UserId.Equals(User.Identity.GetUserId()));
            share.ListSystemShare = repoSystemShare.Gets().Where(m => m.Enable.Equals(true)).ToList();
            model.Share = share;
            #endregion

            return PartialView("_ExperiencePartial", model);
        }
 public ActionResult Index(string account)
 {
     var model = new AboutViewModel();
     var repo = new Repository<UserModel>(DbCollection.User);
     var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting);
     var repoSystemShare = new Repository<SystemShareModel>(DbCollection.SystemShare);
     var repoEducation = new Repository<EducationModel>(DbCollection.Education);
     var repoExperience = new Repository<ExperienceModel>(DbCollection.Experience);
     var repoExperienceEmployment = new Repository<ExperienceEmploymentModel>(DbCollection.ExperienceEmployment);
     var repoContact = new Repository<ContactModel>(DbCollection.Contact);
     var repoContactType = new Repository<ContactTypeModel>(DbCollection.ContactType);
     var userId = !string.IsNullOrEmpty(account) ? account.Split('-').Last() : User.Identity.GetUserId();
     var user = repo.GetById(userId);
     model.User = user;
     var share = new ShareViewModel
     {
         ShareSetting = repoShare.Gets().First(m => m.UserId.Equals(userId)),
         ListSystemShare = repoSystemShare.Gets().Where(m => m.Enable.Equals(true)).ToList()
     };
     model.Share = share;
     model.ListEducation = repoEducation.Gets().Where(m => m.UserId.Equals(userId)).ToList();
     model.Experience = repoExperience.Gets().FirstOrDefault(m => m.UserId.Equals(userId)) ??
                        new ExperienceModel();
     model.ListExperienceEmployment = repoExperienceEmployment.Gets().Where(m => m.UserId.Equals(userId)).ToList();
     model.ListContact = repoContact.Gets().Where(m => m.UserId.Equals(userId)).ToList();
     model.ListContactType = repoContactType.Gets().ToList();
     // Read or Edit
     model.Modify = userId == User.Identity.GetUserId();
     model.FlIdUser = user.FirstName.UrlFriendly() + '-' + user.LastName.UrlFriendly() + "-" + user.Id;
     // Test Log
     Log.Error(new Exception("Test"));
     return View(model);
 }
 public SelectableContactElement(ShareViewModel.SelectableContact contact)
     : base(contact.DisplayName)
 {
     this.Contact = contact;
 }