public async Task <Post_Sub_Category_Response> SaveAsync(Post_sub_category post_Sub_Category) { try{ await post_Sub_Category_Repository.AddAsync(post_Sub_Category); await unit_Of_Work.CompleteAsync(); return(new Post_Sub_Category_Response(post_Sub_Category)); } catch (Exception ex) { return(new Post_Sub_Category_Response($"Error while saving post-sub-category. Message:{ex.Message}")); } }
public async Task <Post_Sub_Category_Response> DeleteAsync(Post_sub_category post_Sub_Category) { var isExist = await post_Sub_Category_Repository.FindByCompatibleKeyAsync(post_Sub_Category.Post_Id, post_Sub_Category.Sub_Category_Id); if (isExist == null) { return(new Post_Sub_Category_Response("Post-sub-category doesn't exist!")); } try{ post_Sub_Category_Repository.Delete(isExist); await unit_Of_Work.CompleteAsync(); return(new Post_Sub_Category_Response(isExist)); } catch (Exception ex) { return(new Post_Sub_Category_Response($"Error with deleting post-sub-category: {ex.Message}")); } }
public void Update(Post_sub_category post_Sub_Category) { context.Post_Sub_Categories.Update(post_Sub_Category); }
public void Delete(Post_sub_category post_Sub_Category) { context.Post_Sub_Categories.Remove(post_Sub_Category); }
public async Task AddAsync(Post_sub_category post_Sub_Category) { await context.Post_Sub_Categories.AddAsync(post_Sub_Category); }
public Post_Sub_Category_Response(bool success, string message, Post_sub_category post_Sub_Category) : base(success, message) { this.post_Sub_Category = post_Sub_Category; }
public Post_Sub_Category_Response(Post_sub_category post_Sub_Category) : this(true, string.Empty, post_Sub_Category) { }