Exemple #1
0
        public bool CreateContent(Models.Data data)
        {
            try
            {
                using (SqlConnection conn = new SqlConnection(connectionString))
                {
                    conn.Open();
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        cmd.Connection  = conn;
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.CommandText = "CreateContent";

                        cmd.Parameters.Add(new SqlParameter("@FormId", data.FormId));
                        cmd.Parameters.Add(new SqlParameter("@FunctionalLocation", data.FunctionalLocation));
                        cmd.Parameters.Add(new SqlParameter("@Sequence", data.Sequence));
                        cmd.Parameters.Add(new SqlParameter("@Content", data.Content));
                        cmd.Parameters.Add(new SqlParameter("@Remarks", data.Remarks));

                        cmd.ExecuteNonQuery();
                        conn.Close();

                        return(true);
                    }
                }
            }
            catch (Exception exp)
            {
                return(true);
            }
        }
 public bool Update(Models.Data data)
 {
     if (data != null)
     {
         //Update data to DB
         using (DataAccessComponent dac = new DataAccessComponent())
         {
             return(dac.UpdateContent(data));
         }
     }
     else
     {
         return(false);
     }
 }