Ejemplo n.º 1
0
        public bool EditHaragPost(int postId, Z_Harag_Post post)
        {
            var isExists = this.IsExists(postId);

            if (!isExists)
            {
                return(false);
            }

            _postRepository.Update(post);

            return(true);
        }
Ejemplo n.º 2
0
        public Z_Harag_Post AddNewPost(PostForPostListModel postForPostModel, int cutomerId, IList <string> files, List <string> errors)
        {
            List <KeyAndValue> filesUrl = UploadFiles(files, errors);

            if (errors.Count > 0)
            {
                return(null);
            }

            var post = new Z_Harag_Post()
            {
                Text               = postForPostModel.Text,
                Title              = postForPostModel.Title,
                CategoryId         = postForPostModel.CategoryId,
                CityId             = postForPostModel.CityId,
                Contact            = postForPostModel.Contact,
                CustomerId         = cutomerId,
                DateCreated        = DateTime.Now,
                IsAnswered         = false,
                IsCommentingClosed = false,
                IsDispayed         = false,
                DateUpdated        = DateTime.Now,
                IsDeleted          = false,
                IsOrder            = postForPostModel.IsOrder,
                IsFeatured         = false,
                IsCommon           = false,
                Tags               = postForPostModel.Tags
            };

            foreach (var item in filesUrl)
            {
                if (item.Key.ToLower() == "image")
                {
                    post.Z_Harag_Photo.Add(new Z_Harag_Photo()
                    {
                        Url = item.Value
                    });
                }
            }

            _postRepository.Insert(post);


            return(post);
        }
Ejemplo n.º 3
0
 public static PostWithFilesModel ToPostWithFilesModel(this Z_Harag_Post entity)
 {
     return(entity.MapTo <Z_Harag_Post, PostWithFilesModel>());
 }
Ejemplo n.º 4
0
 public static Z_Harag_Post ToEntity(this PostModel model, Z_Harag_Post destination)
 {
     return(model.MapTo(destination));
 }