public GreetingModel Delete(int Employeeid) { GreetingModel model = _context.Employees.Find(Employeeid); if (model != null) { _context.Employees.Remove(model); } _context.SaveChanges(); return(model); }
public void AddFavoriteRepository(string username, string repositoryname) { if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(repositoryname)) { if (_context.FavoriteRepositories .Where(x => x.UserName == username && x.RepositoryName == repositoryname).FirstOrDefault() == null) { FavoriteRepository newRepo = new FavoriteRepository { RepositoryName = repositoryname, UserName = username }; _context.FavoriteRepositories.Add(newRepo); _context.SaveChanges(); } } }