public bool Update(Question ques)
        {
            var model = context.Questions.Find(ques.QuestionId);

            model.QuestionName = ques.QuestionName;
            model.TopicId      = ques.TopicId;
            return(context.SaveChanges() > 0);
        }
 public bool AddUser(UserViewModel user)
 {
     context.Users.Add(new User
     {
         Name  = user.Name,
         Email = user.Email,
         Phone = user.Phone
     });
     return(context.SaveChanges() > 0);
 }
        public Intern AddMember(Intern member)
        {
            if (member.Location == null)
            {
                member.Location = GetDefaultLocation();
            }

            db.Interns.AddRange(member);
            db.SaveChanges();
            return(member);
        }
Beispiel #4
0
 public bool SaveTestResult(TestResultViewModel testResult, int userId, int?topicId)
 {
     context.Scores.Add(new Score()
     {
         Detail   = testResult.Detail,
         Score1   = testResult.Score,
         TestDate = DateTime.Now,
         TopicId  = topicId,
         UserId   = userId
     });
     return(context.SaveChanges() > 0);
 }
 public long Insert(Answer ans)//them moi ban ghi
 {
     context.Answers.Add(ans);
     context.SaveChanges();
     return(ans.AnswerId);
 }
Beispiel #6
0
 public long Insert(AdminUser admin)//them moi ban ghi
 {
     context.AdminUsers.Add(admin);
     context.SaveChanges();
     return(admin.ID);
 }
 public Employee AddEmployee(Employee employee)
 {
     db.Employees.AddRange(employee);
     db.SaveChanges();
     return(employee);
 }
 public long Insert(Topic topic)//them moi ban ghi
 {
     context.Topics.Add(topic);
     context.SaveChanges();
     return(topic.TopicId);
 }