Example #1
0
 public MyPostItemViewModel(IMvxNavigationService navigationService, BasePostViewModel post,
                            IMvxAsyncCommand <MyPostItemViewModel> removeCommand)
 {
     _navigationService = navigationService;
     Post           = post;
     _removeCommand = removeCommand;
 }
Example #2
0
 public async Task <ApiResult <BasePostViewModel> > UpdatePost(BasePostViewModel post)
 {
     return(await ApiRequestHelper.HandlApiRequest(async() =>
     {
         var newPost = await _api.UpdatePost(Mapper.Map <Post>(post));
         return new ApiResult <BasePostViewModel>(string.Empty, true, new BasePostViewModel(newPost));
     }));
 }
        public async Task <IActionResult> UpdatePostAsync([FromForm] BasePostViewModel view)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState.GetErrorMessages()));
            }

            var result = await _service.EditPostAsync(view);

            return(Ok(result));
        }
        public void AddPost_ItshouldAddPost_Success()
        {
            var userId = new BasePostViewModel()
            {
                UserID = 13600,
                Text   = " new Test...",
                TypeID = PostType.Text
            };

            //var mm = _socialService.AddPostAsync(userId).Result;

            //Assert.IsNotNull(mm.Post);
        }
Example #5
0
        public static object GetSortingObject(this BasePostViewModel model, PostSortOptions sortOptions)
        {
            switch (sortOptions)
            {
            case PostSortOptions.Date:
                return(null);

            case PostSortOptions.Popularity:
                return(model.LikesCount);

            case PostSortOptions.Price:
                return(model.Price);

            case PostSortOptions.UserRating:
                return(model.User.AverageGrade);

            default:
                throw new ArgumentOutOfRangeException(nameof(sortOptions), sortOptions, null);
            }
        }
 public static void SetAttachmentProperties(this BasePostViewModel basePost, ILogger logger)
 {
     foreach (var a in basePost.PostAttachments)
     {
         var sections = a.Name.Split('$');
         try
         {
             a.Width  = int.Parse(sections[1]);
             a.Height = int.Parse(sections[2]);
             if (a.AttachmentType == Domain.AggregatesModel.PostAggregate.AttachmentType.Video)
             {
                 a.Thumbnail = a.Name.Substring(0, a.Name.LastIndexOf('.')) + ".jpg";
             }
         }
         catch (Exception ex)
         {
             logger.LogError("SetAttachmentProperties: {@SetAttachmentPropertiesException}", ex);
         }
     }
     ;
 }
Example #7
0
 public UserPostItemViewModel(IMvxNavigationService navigationService, BasePostViewModel post, IPostService postService)
 {
     _navigationService = navigationService;
     Post         = post;
     _postService = postService;
 }
Example #8
0
 public NeighboorhoodItemViewModel(BaseNeighborhoodViewModel neighborhood, BasePostViewModel post)
 {
     Neighborhood = neighborhood;
     Post         = post;
 }
Example #9
0
 public AdminUserPostItemViewModel(IMvxNavigationService navigationService, BasePostViewModel post)
 {
     _navigationService = navigationService;
     Post = post;
 }
 public PostItemViewModel(IMvxNavigationService navigationService, BasePostViewModel basePostViewModel)
 {
     _navigationService = navigationService;
     Post         = basePostViewModel;
     _postService = Mvx.Resolve <IPostService>();
 }
Example #11
0
 public AdminPostItemViewModel(IMvxNavigationService navigationService, BasePostViewModel basePostViewModel, IMvxAsyncCommand <AdminPostItemViewModel> removeCommand, IPostService postService, IToastSerivce toastSerivce)
 {
     _navigationService = navigationService;
     Post           = basePostViewModel;
     _removeCommand = removeCommand;
 }