public AddCollectionResponse UpdateCollection(AddCollectionRequest request) { if (request == null || request.Collection == null) { return(new AddCollectionResponse { Message = "Could not add collection", ResponseType = ResponseType.Succeeded }); } string oradb = System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; OracleConnection conn = new OracleConnection(oradb); conn.Open(); OracleCommand cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "update collection set title = '" + request.Collection.Title + "', description = '" + request.Collection.Description + "', isprivate = '" + Convert.ToInt32(request.Collection.IsPrivate).ToString() + "' where id = " + request.Collection.ID; cmd.CommandType = CommandType.Text; OracleDataReader dr = cmd.ExecuteReader(); GetCollectionsResponse response = new GetCollectionsResponse(); conn.Dispose(); conn.Close(); return(new AddCollectionResponse { ResponseType = ResponseType.Succeeded }); }
public AddCollectionResponse SaveCollection(AddCollectionRequest request) { if (request == null || request.Collection == null) { return(new AddCollectionResponse { Message = "Could not add collection", ResponseType = ResponseType.Succeeded }); } string oradb = System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; OracleConnection conn = new OracleConnection(oradb); conn.Open(); OracleCommand cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "insert into collection (id, title, description, isprivate, createdby, datecreated, modifiedby, datemodified, isdeleted) values(collection_seq.NEXTVAL,'" + request.Collection.Title + "', '" + request.Collection.Description + "', '" + Convert.ToInt32(request.Collection.IsPrivate).ToString() + "', '1', sysdate, '1', sysdate, '0')"; cmd.CommandType = CommandType.Text; OracleDataReader dr = cmd.ExecuteReader(); GetCollectionsResponse response = new GetCollectionsResponse(); conn.Dispose(); conn.Close(); return(new AddCollectionResponse { ResponseType = ResponseType.Succeeded }); }