Пример #1
0
        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));
        }
Пример #2
0
        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);
        }