public MyPostItemViewModel(IMvxNavigationService navigationService, BasePostViewModel post, IMvxAsyncCommand <MyPostItemViewModel> removeCommand) { _navigationService = navigationService; Post = post; _removeCommand = removeCommand; }
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); }
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); } } ; }
public UserPostItemViewModel(IMvxNavigationService navigationService, BasePostViewModel post, IPostService postService) { _navigationService = navigationService; Post = post; _postService = postService; }
public NeighboorhoodItemViewModel(BaseNeighborhoodViewModel neighborhood, BasePostViewModel post) { Neighborhood = neighborhood; Post = post; }
public AdminUserPostItemViewModel(IMvxNavigationService navigationService, BasePostViewModel post) { _navigationService = navigationService; Post = post; }
public PostItemViewModel(IMvxNavigationService navigationService, BasePostViewModel basePostViewModel) { _navigationService = navigationService; Post = basePostViewModel; _postService = Mvx.Resolve <IPostService>(); }
public AdminPostItemViewModel(IMvxNavigationService navigationService, BasePostViewModel basePostViewModel, IMvxAsyncCommand <AdminPostItemViewModel> removeCommand, IPostService postService, IToastSerivce toastSerivce) { _navigationService = navigationService; Post = basePostViewModel; _removeCommand = removeCommand; }