public AssignmentVM DeleteAssignment(string dictaatName, int assignmentId) { var assignment = _context.Assignments.FirstOrDefault(a => a.Id == assignmentId && a.DictaatDetailsId == dictaatName); if (assignment == null) { return(null); } _context.Remove(assignment); _context.SaveChanges(); return(new AssignmentVM(assignment)); }
public bool RemoveUserAchievement(int achievementid, string userid) { var achiev = _context.UserAchievements .FirstOrDefault(a => a.AchievementId == achievementid && a.UserId == userid); if (achiev == null) { return(false); } _context.Remove(achiev); _context.SaveChanges(); return(true); }