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}")); } }
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}")); } }
public void Update(Post_type post_Type) { context.Post_Types.Update(post_Type); }
public void Delete(Post_type post_Type) { context.Post_Types.Remove(post_Type); }
public async Task AddAsync(Post_type post_Type) { await context.Post_Types.AddAsync(post_Type); }
public Post_Type_Response(bool success, string message, Post_type post_Type) : base(success, message) { this.post_Type = post_Type; }
public Post_Type_Response(Post_type post_Type) : this(true, string.Empty, post_Type) { }