public void DeleteAuthor(AuthorInputType authorInputType) { var author = _dbContext.Author.Where(x => x.Id == authorInputType.Id).FirstOrDefault(); _dbContext.Author.Remove(author); _dbContext.SaveChanges(); }
public void DeleteAuthor(AuthorInputType author) { var auth = _context.Author.Where(z => z.Id == author.Id).FirstOrDefault(); _context.Author.Remove(auth); _context.SaveChanges(); }
public Author DeleteAuthor(AuthorInputType author) { var bk = _context.Author.Where(b => b.Id == b.Id).FirstOrDefault(); _context.Author.Remove(bk); _context.SaveChanges(); return(bk); }
public void DeleteAuthor(AuthorInputType author) { var authorObj = context.Author.FirstOrDefault(authorTmp => authorTmp.Id == author.Id); if (authorObj != null) { context.Author.Remove(authorObj); context.SaveChanges(); } }
public void UpdateAuthor(AuthorInputType author) { var auth = _context.Author.Where(z => z.Id == author.Id).FirstOrDefault(); auth.Name = author.Name; auth.Surname = author.Surname; _context.Author.Update(auth); _context.SaveChanges(); }
public Author UpdateAuthor(AuthorInputType author) { var bk = _context.Author.Where(b => b.Id == b.Id).FirstOrDefault(); bk.Name = author.Name; bk.Surname = author.Surname; _context.Author.Update(bk); _context.SaveChanges(); return(bk); }
public Author AddAuthor(AuthorInputType author) { var authorObj = new Author() { Name = author.Name, Surname = author.Surname, }; context.Add(authorObj); context.SaveChanges(); return(authorObj); }
public Author UpdateAuthor(AuthorInputType authorInputType) { var author = _dbContext.Author.Where(x => x.Id == authorInputType.Id).FirstOrDefault(); author.Name = authorInputType.Name; author.Surname = authorInputType.SurName; _dbContext.Author.Update(author); _dbContext.SaveChanges(); return(author); }
public Author AddAuthor(AuthorInputType author) { var auth = new Author { Name = author.Name, Surname = author.Surname }; _context.Author.Add(auth); _context.SaveChanges(); return(auth); }
public Author AddAuthor(AuthorInputType authorInputType) { var author = new Author() { Name = authorInputType.Name, Surname = authorInputType.SurName }; _dbContext.Author.Add(author); _dbContext.SaveChanges(); return(author); }
public Author AddAuthor(AuthorInputType author) { var bk = new Author() { Id = author.Id, Name = author.Name, Surname = author.Surname }; _context.Author.Add(bk); _context.SaveChanges(); return(bk); }
public Author UpdateAuthor(AuthorInputType author) { var authorObj = context.Author.FirstOrDefault(authorTmp => authorTmp.Id == author.Id); if (authorObj != null) { authorObj.Name = author.Name; authorObj.Surname = author.Surname; context.Author.Update(authorObj); context.SaveChanges(); } return(authorObj ?? new Author()); }