Ejemplo n.º 1
0
        public async Task <Post_Type_Response> SaveAsync(Post_type post_Type)
        {
            try{
                await post_Type_Repository.AddAsync(post_Type);

                await unit_Of_Work.CompleteAsync();

                return(new Post_Type_Response(post_Type));
            }
            catch (Exception ex) {
                return(new Post_Type_Response($"Error while saving post-type. Message:{ex.Message}"));
            }
        }
Ejemplo n.º 2
0
        public async Task <Post_Type_Response> UpdateAsync(Post_type post_Type)
        {
            var isExist = await post_Type_Repository.FindByIdAsync(post_Type.Id);

            if (isExist == null)
            {
                return(new Post_Type_Response("Post type not found!"));
            }
            try
            {
                post_Type_Repository.Update(post_Type);
                await unit_Of_Work.CompleteAsync();

                return(new Post_Type_Response(post_Type));
            }
            catch (Exception ex)
            {
                return(new Post_Type_Response($"Error when updating post type: {ex.Message}"));
            }
        }
Ejemplo n.º 3
0
 public void Update(Post_type post_Type)
 {
     context.Post_Types.Update(post_Type);
 }
Ejemplo n.º 4
0
 public void Delete(Post_type post_Type)
 {
     context.Post_Types.Remove(post_Type);
 }
Ejemplo n.º 5
0
 public async Task AddAsync(Post_type post_Type)
 {
     await context.Post_Types.AddAsync(post_Type);
 }
Ejemplo n.º 6
0
 public Post_Type_Response(bool success, string message, Post_type post_Type) : base(success, message)
 {
     this.post_Type = post_Type;
 }
Ejemplo n.º 7
0
 public Post_Type_Response(Post_type post_Type) : this(true, string.Empty, post_Type)
 {
 }