/// <summary>
        /// This method updates group details
        /// </summary>
        /// <param name="group"></param>
        /// <returns>true or false   </returns>
        public bool UpdatGroup(Group group)
        {
            db.Entry(group).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
        public bool Update(Answer Ans, int userId)
        {
            if (Ans == null)
            {
                throw new ArgumentNullException("Answer");
            }

            // TO DO : Code to save record into database
            try
            {
                Db2.Entry(Ans).State = EntityState.Modified;
                Db2.User_Answer.Add(new User_Answer()
                {
                    activity_id = Ans.activity_id, question_id = Ans.question_id, user_id = userId, answer_id = Ans.id
                });
                Db2.SaveChanges();
            }
            catch (DbUpdateException ex)
            {
                throw ex;
            }
            return(true);
        }