Пример #1
0
        public int Insert(NotificationModal notification)
        {
            int rowsAffected = 0;

            using (SqlConnection connection = new SqlConnection(_connectionString))
            {
                connection.Open();
                SqlCommand com = new SqlCommand("spInsertNotification", connection);
                com.CommandType = CommandType.StoredProcedure;
                com.Parameters.AddWithValue("@SessionId", notification.SessionId);
                com.Parameters.AddWithValue("@SemesterId", notification.SemesterId);
                com.Parameters.AddWithValue("@CourseId", notification.CourseId);
                com.Parameters.AddWithValue("@TeacherId", notification.TeacherId);
                com.Parameters.AddWithValue("@NotificationName", notification.NotificationName);
                com.Parameters.AddWithValue("@NotificationDescription", notification.NotificationDescription);
                try
                {
                    rowsAffected = com.ExecuteNonQuery();
                }
                catch (Exception excp)
                {
                    return(0);
                }
                return(rowsAffected);
            }
        }
Пример #2
0
 public JsonResult Insert(NotificationModal notification)
 {
     return(Json(_databaseConnection.Insert(notification), JsonRequestBehavior.AllowGet));
 }