public async Task <int> Add <T>(T model) { var comment = Mapper.Map <Comment>(model); _data.Comments.Add(comment); await _data.SaveChangesAsync(); return(comment.Id); }
public async Task <bool> Edit <T>(T model) { try { Blog blogToEdit = AutoMapper.Mapper.Map <Blog>(model); _data.Blogs.Update(blogToEdit); await _data.SaveChangesAsync(); return(true); } catch (Exception) { return(false); } }